root/afridex/plugins/fresh-page/RCCWP_WritePostPage.php

Revision 21, 28.0 kB (checked in by admin, 18 years ago)
Line 
1<?php
2class RCCWP_WritePostPage
3{
4        function ApplyCustomWritePanelAssignedCategories($content)
5        {
6                global $CUSTOM_WRITE_PANEL;
7               
8                $assignedCategoryIds = RCCWP_CustomWritePanel::GetAssignedCategoryIds($CUSTOM_WRITE_PANEL->id);
9                foreach ($assignedCategoryIds as $categoryId)
10                {
11                        $toReplace = 'id="in-category-' . $categoryId . '"';
12                        $replacement = $toReplace . ' checked="checked"';
13                        $content = str_replace($toReplace, $replacement, $content);
14                }
15               
16                return $content;
17        }
18       
19        function ApplyCustomWritePanelStandardFields()
20        {
21                global $CUSTOM_WRITE_PANEL;
22               
23                $displayCssIds = RCCWP_CustomWritePanel::GetStandardFieldCssIds($CUSTOM_WRITE_PANEL->id);
24                $wpCssIds = RCCWP_Application::GetWpStandardFieldCssIds();
25               
26                $hideCssIds = array_diff($wpCssIds, $displayCssIds);
27               
28                if (empty($hideCssIds))
29                        return;
30               
31                if (in_array('postdiv', $hideCssIds))
32                {
33                        array_push($hideCssIds, 'postdivrich');
34                }
35               
36                array_walk($hideCssIds, create_function('&$item1, $key', '$item1 = "#" . $item1;'));
37                $hideCssIdString = implode(', ', $hideCssIds);
38                ?>
39               
40                <style type="text/css"><?=$hideCssIdString?> {display: none !important;}</style>
41               
42                <?php
43        }
44       
45        function HideCustomWritePanelExternalFields()
46        {
47                global $CUSTOM_WRITE_PANEL;
48               
49                $hideCssIds = RCCWP_CustomWritePanel::GetHiddenExternalFieldCssIds($CUSTOM_WRITE_PANEL->id);
50                if (empty($hideCssIds))
51                        return;
52                       
53                array_walk($hideCssIds, create_function('&$item1, $key', '$item1 = "#" . $item1;'));
54                $hideCssIdString = implode(', ', $hideCssIds);
55                ?>
56               
57                <style type="text/css"><?=$hideCssIdString?> {display: none !important;}</style>
58               
59                <?php   
60        }
61       
62        function CustomFieldCollectionInterface()
63        {
64                global $CUSTOM_WRITE_PANEL;
65               
66                if (!isset($CUSTOM_WRITE_PANEL))
67                        return;
68               
69                $customFields = array();
70                $customFields = RCCWP_CustomWritePanel::GetCustomFields($CUSTOM_WRITE_PANEL->id);
71                ?>
72                <style type="text/css">.form-table td{background-color:#fff;margin-bottom:0;border:none;} .form-table input, .form-table textarea{border-color:#ccc;}</style>
73                <div id="freshpagediv" class="postbox">
74                        <h3><a class="togbox">+</a> Freshpage Panel</h3>
75                        <div class="inside">
76                        <table class="form-table" border="0">
77               
78                <?php
79                foreach ($customFields as $field)
80                {
81                        RCCWP_WritePostPage::CustomFieldInterface($field);
82                }
83                ?>
84               
85                        </table>
86                </div>
87                </div>
88                <input type="hidden" name="rc-custom-write-panel-verify-key" id="rc-custom-write-panel-verify-key" value="<?=wp_create_nonce('rc-custom-write-panel')?>" />
89                <input type="hidden" name="rc-cwp-custom-write-panel-id" value="<?=$CUSTOM_WRITE_PANEL->id?>" />
90                <!-- rc_cwp_submit_buttons -->
91               
92                <?php
93        }
94       
95        function CustomFieldInterface($customField)
96        {
97                switch ($customField->type)
98                {
99                        case 'Textbox' :
100                                RCCWP_WritePostPage::TextboxInterface($customField);
101                                break;
102                        case 'Multiline Textbox' :
103                                RCCWP_WritePostPage::MultilineTextboxInterface($customField);
104                                break;
105                        case 'Checkbox' :
106                                RCCWP_WritePostPage::CheckboxInterface($customField);
107                                break;
108                        case 'Checkbox List' :
109                                RCCWP_WritePostPage::CheckboxListInterface($customField);
110                                break;
111                        case 'Radiobutton List' :
112                                RCCWP_WritePostPage::RadiobuttonListInterface($customField);
113                                break;
114                        case 'Dropdown List' :
115                                RCCWP_WritePostPage::DropdownListInterface($customField);
116                                break;
117                        case 'Listbox' :
118                                RCCWP_WritePostPage::ListboxInterface($customField);
119                                break;
120                        case 'File' :
121                                RCCWP_WritePostPage::FileInterface($customField);
122                                break;
123                        case 'Image' :
124                                RCCWP_WritePostPage::PhotoInterface($customField);
125                                break;
126                        case 'Date' :
127                                RCCWP_WritePostPage::DateInterface($customField);
128                                break;
129                        case 'Audio' :
130                                RCCWP_WritePostPage::AudioInterface($customField);
131                                break;
132                        default:
133                                ;
134                }
135        }
136       
137        function CheckboxInterface($customField)
138        {
139                $customFieldId = '';
140                $customFieldName = attribute_escape($customField->name);
141                $customFieldTitle = attribute_escape($customField->description);
142                $inputName = RC_Format::GetInputName($customField->name);
143               
144                if (isset($_REQUEST['post']))
145                {
146                        $customFieldId = $customField->id;
147                        $value = RCCWP_CustomField::GetCustomFieldValue($_REQUEST['post'], $customField->name);
148                        $checked = $value == 'true' ? 'checked="checked"' : '';
149                }
150                ?>
151               
152                <tr>
153                <td>
154                <label for="<?=$inputName?>">
155                <input type="hidden" name="<?=$inputName?>" value="false" />
156                <input tabindex="3" class="checkbox" name="<?=$inputName?>" value="true" id="<?=$inputName?>" type="checkbox" <?=$checked?> />
157                <?=$customFieldTitle?>
158                <input type="hidden" name="rc_cwp_meta_ids[]" value="<?=$customFieldId?>" />
159                <input type="hidden" name="rc_cwp_meta_keys[]" value="<?=$inputName?>" />
160                </label>
161                </td>
162                </tr>
163               
164                <?php
165        }
166       
167        function CheckboxListInterface($customField)
168        {
169                $customFieldId = '';
170                $customFieldName = attribute_escape($customField->name);
171                $customFieldTitle = attribute_escape($customField->description);
172                $inputName = RC_Format::GetInputName($customField->name);
173               
174                $values = array();
175                if (isset($_REQUEST['post']))
176                {
177                        $customFieldId = $customField->id;
178                        $values = RCCWP_CustomField::GetCustomFieldValues($_REQUEST['post'], $customField->name);
179                }
180                else
181                {
182                        $values = $customField->default_value;
183                }
184                ?>
185               
186                <tr>
187                <td>
188                <fieldset style="border:1px solid #ddd;padding:10px;">
189                <legend style="padding:3px;font-weight:bold;"><?=$customFieldTitle?></legend>
190               
191                <?php
192                foreach ($customField->options as $option) :
193                        $option = attribute_escape(trim($option));
194                        $checked = in_array($option, (array)$values) ? 'checked="checked"' : '';
195                ?>
196               
197                        <label for="" class="selectit">
198                                <input tabindex="3" id="<?=$option?>" name="<?=$inputName?>[]" value="<?=$option?>" type="checkbox" <?=$checked?>/>
199                                <?=attribute_escape($option)?>
200                        </label><br />
201               
202                <?php
203                endforeach;
204                ?>
205                        </fieldset>
206                        <input type="hidden" name="rc_cwp_meta_ids[]" value="<?=$customFieldName?>" />
207                        <input type="hidden" name="rc_cwp_meta_keys[]" value="<?=$inputName?>" />
208                </td>
209                </tr>
210               
211                <?php
212        }
213       
214        function DropdownListInterface($customField)
215        {
216                $customFieldId = '';
217                $customFieldName = attribute_escape($customField->name);
218                $customFieldTitle = attribute_escape($customField->description);
219                $inputName = RC_Format::GetInputName($customField->name);
220               
221                if (isset($_REQUEST['post']))
222                {
223                        $customFieldId = $customField->id;
224                        $value = attribute_escape(RCCWP_CustomField::GetCustomFieldValue($_REQUEST['post'], $customField->name));
225                }
226                else
227                {
228                        $value = $customField->default_value[0];
229                }
230                ?>
231               
232                <tr>
233                <td>
234                <label for="<?=$inputName?>"><?=$customFieldTitle?></label><br />
235                <select tabindex="3" name="<?=$inputName?>">
236                        <option value="">--Select--</option>
237               
238                <?php
239                foreach ($customField->options as $option) :
240                        $option = attribute_escape(trim($option));
241                        $selected = $option == $value ? 'selected="selected"' : '';
242                ?>
243               
244                        <option value="<?=$option?>" <?=$selected?>><?=$option?></option>
245               
246                <?php
247                endforeach;
248                ?>
249               
250                </select>       
251                <input type="hidden" name="rc_cwp_meta_ids[]" value="<?=$customFieldId?>" />
252                <input type="hidden" name="rc_cwp_meta_keys[]" value="<?=$inputName?>" />
253                </td>
254                </tr>
255               
256                <?php
257        }
258       
259        function ListboxInterface($customField)
260        {
261                $customFieldId = '';
262                $customFieldName = attribute_escape($customField->name);
263                $customFieldTitle = attribute_escape($customField->description);
264                $inputName = RC_Format::GetInputName($customField->name);
265                $inputSize = (int)$customField->properties['size'];
266               
267                if (isset($_REQUEST['post']))
268                {
269                        $customFieldId = $customField->id;
270                        $values = RCCWP_CustomField::GetCustomFieldValues($_REQUEST['post'], $customField->name);
271                }
272                else
273                {
274                        $values = $customField->default_value;
275                }
276                ?>
277               
278                <tr>
279                <td>
280                <label for="<?=$inputName?>"><?=$customFieldTitle?></label><br />
281                <select tabindex="3" id="<?=$inputName?>" name="<?=$inputName?>[]" multiple size="<?=$inputSize?>">
282               
283                <?php
284                foreach ($customField->options as $option) :
285                        $option = attribute_escape(trim($option));
286                        $selected = in_array($option, (array)$values) ? 'selected="selected"' : '';
287                ?>
288                       
289                        <option value="<?=$option?>" <?=$selected?>><?=$option?></option>
290                       
291                <?php
292                endforeach;
293                ?>
294               
295                </select>
296                <input type="hidden" name="rc_cwp_meta_ids[]" value="<?=$customFieldId?>" />
297                <input type="hidden" name="rc_cwp_meta_keys[]" value="<?=$inputName?>" />
298                </td>
299                </tr>
300               
301                <?php
302        }
303       
304        function MultilineTextboxInterface($customField)
305        {
306                $customFieldId = '';
307                $customFieldName = attribute_escape($customField->name);
308                $customFieldTitle = attribute_escape($customField->description);
309                $inputName = RC_Format::GetInputName($customField->name);
310                $inputHeight = (int)$customField->properties['height'];
311                $inputWidth = (int)$customField->properties['width'];
312               
313                if (isset($_REQUEST['post']))
314                {
315                        $customFieldId = $customField->id;
316                        $value = attribute_escape(RCCWP_CustomField::GetCustomFieldValue($_REQUEST['post'], $customField->name));
317                }
318                ?>
319               
320                <tr>
321                <td>
322                <label for="<?=$inputName?>"><?=$customFieldTitle?></label><br />
323                <textarea tabindex="3" id="<?=$inputName?>" name="<?=$inputName?>" rows="<?=$inputHeight?>" cols="<?=$inputWidth?>"><?=$value?></textarea>
324                <input type="hidden" name="rc_cwp_meta_ids[]" value="<?=$customFieldId?>" />
325                <input type="hidden" name="rc_cwp_meta_keys[]" value="<?=$inputName?>" />
326                </td>
327                </tr>
328               
329                <?php
330        }
331       
332        function TextboxInterface($customField)
333        {
334                $customFieldId = '';
335                $customFieldName = attribute_escape($customField->name);
336                $customFieldTitle = attribute_escape($customField->description);
337                $inputName = RC_Format::GetInputName($customField->name);
338                $inputSize = (int)$customField->properties['size'];
339               
340                if (isset($_REQUEST['post']))
341                {
342                        $customFieldId = $customField->id;
343                        $value = attribute_escape(RCCWP_CustomField::GetCustomFieldValue($_REQUEST['post'], $customField->name));
344                }
345                ?>
346               
347                <tr>
348                <td>
349                <label for="<?=$inputName?>"><?=$customFieldTitle?></label><br />
350                <input tabindex="3" id="<?=$inputName?>" name="<?=$inputName?>" value="<?=$value?>" type="text" size="<?=$inputSize?>" />
351                <input type="hidden" name="rc_cwp_meta_ids[]" value="<?=$customFieldId?>" />
352                <input type="hidden" name="rc_cwp_meta_keys[]" value="<?=$inputName?>" />
353                </td>
354                </tr>
355               
356                <?php
357        }
358       
359
360        function FileInterface($customField)
361        {
362                $customFieldId = '';
363                $customFieldName = attribute_escape($customField->name);
364                $customFieldTitle = attribute_escape($customField->description);
365                $inputName = RC_Format::GetInputName($customField->name);
366                $urlName = RC_Format::GetInputName( $customField->name . '_url' );
367                $filepath = RC_Format::GetInputName( $customField->name . '_filepath' );
368
369                if (isset($_REQUEST['post']))
370                {
371                        $customFieldId = $customField->id;
372                        $value = attribute_escape(RCCWP_CustomField::GetCustomFieldValue($_REQUEST['post'], $customField->name));
373                }
374
375                ?>
376               
377                <tr>
378                <td>
379                <label for="<?=$inputName?>"><?=$customFieldTitle?></label>
380                <?php if( $value ){ echo '(<a href="' . $value . '" target="_blank">View Current</a>)'; } ?>
381                </td>
382                </tr>
383                <tr>
384                <td>
385                <input tabindex="3"
386                        id="<?=$inputName?>"
387                        name="<?=$inputName?>"
388                        type="file"
389                        style="visibility:hidden;height:0px"
390                        />
391               
392                <input tabindex="3"
393                        id="<?=$filepath?>"
394                        name="<?=$filepath?>"
395                        type="hidden"
396                        size="46"
397                        onchange="var postForm=document.getElementById('post');postForm.encoding='multipart/form-data';"
398                        />
399
400
401
402                <div id='upload_iframe_<?=$filepath?>'>
403                <iframe id='upload_internal_iframe_<?=$filepath?>' src='./../wp-content/plugins/fresh-page/RCCWP_upload.php?input_name=<?=$filepath?>&type=0' frameborder='' scrolling='0' style="border-width: 0px; height: 75px;width: 800px;vertical-align:top;"></iframe>
404                </div>
405                <div id="upload_progress_<?=$filepath?>" style="visibility:hidden;height:0px"></div>
406
407
408
409
410
411                <input type="hidden" name="rc_cwp_meta_ids[]"    value="<?=$customFieldId?>"    />
412                <input type="hidden" name="rc_cwp_meta_keys[]"   value="<?=$inputName?>"        />
413                <input type="hidden" name="rc_cwp_meta_files[]"  value="<?=$inputName?>"        />
414                <input type="hidden" name="<?=$inputName?>_last" value="<?=$value?>"            />
415                </td>
416                </tr>
417               
418                <?php
419        }
420
421
422        function PhotoInterface($customField)
423        {
424                $customFieldId  = '';
425                $customFieldName= attribute_escape($customField->name);
426                $customFieldTitle = attribute_escape($customField->description);
427                $inputName              = RC_Format::GetInputName($customField->name);
428                $urlName                = RC_Format::GetInputName( $customField->name . '_url' );
429                $filepath               = RC_Format::GetInputName( $customField->name . '_filepath' );
430                $params                 = $customField->properties['params'];
431                $noimage                = "";
432
433                global $countImageThumbID;
434                $imageThumbID = "";
435                $imageThumbID = "img_thumb_".++$countImageThumbID;
436
437                if (isset($_REQUEST['post']))
438                {
439                        $customFieldId = $customField->id;
440//                      $value = attribute_escape(RCCWP_CustomField::GetCustomFieldValue($_REQUEST['post'], $customField->name));
441                        $value = RCCWP_CustomField::GetCustomFieldValue($_REQUEST['post'], $customField->name);
442                       
443                        if(!(strpos($value, 'http') === FALSE))
444                                $hidValue = str_replace('"', "'", $value);
445                        $value = stripslashes(trim("\<img src=\'".$value."\' class=\"freshout\" \/\>"));
446                }
447                else
448                {
449                        $noimage = "<img src='./../wp-content/plugins/fresh-page/images/noimage.jpg' />";
450                }
451                if($hidValue == '')
452                {
453                        $noimage = "<img src='./../wp-content/plugins/fresh-page/images/noimage.jpg' />";
454                }
455
456                include_once('RCCWP_Options.php');
457                $useSnipshot = RCCWP_Options::Get('use-snipshot');
458       
459                ?>
460               
461                <tr>
462                        <td><label for="<?=$inputName?>"><?=$customFieldTitle?></label> <span id="spanImageSize"></span></td>
463                </tr>
464                <tr>
465                        <td>
466                                <table width="650px" border="0">
467                                        <tr>
468                                                <td rowspan="3" width="25%">
469                                                        <?php
470                                                                if($value != "")
471                                                                { 
472                                                                        if(!(strpos($value, '<img src') === FALSE))
473                                                                        {
474                                                                                $valueLinkArr = explode("'", $value);
475                                                                                $valueLink = $valueLinkArr[1];
476                                                                                //$valueLink = $value;
477               
478                                                                                if(!(strpos($value, '&sw') === FALSE))
479                                                                                {
480                                                                                        // Calculating Image Width/Height
481                                                                                        $arrSize = explode("=",$value);
482                                                                                        $arrSize1 = explode("&",$arrSize[3]);
483                                                                                        $arrSize2 = explode("&",$arrSize[4]);
484               
485                                                                                        $imageWidth = $arrSize1[0];
486                                                                                        $imageHeight = $arrSize2[0];
487                                                                                        // END
488               
489                                                                                        $valueArr = explode("&sw", $value);
490                                                                                        $valueArr = explode("'", $valueArr[1]);
491                                                                                        $value = str_replace("&sw".$valueArr[0]."'", "&sw".$valueArr[0]."&w=150&h=120' align='left' id='".$imageThumbID."'", $value);
492                                                                                }
493                                                                                else if(!(strpos($value, '&w') === FALSE))
494                                                                                {
495                                                                                        // Calculating Image Width/Height
496                                                                                        $arrSize = explode("=",$value);
497                                                                                        $arrSize1 = explode("&",$arrSize[3]);
498                                                                                        $arrSize2 = explode("'",$arrSize[4]);
499               
500                                                                                        $imageWidth = $arrSize1[0];
501                                                                                        $imageHeight = $arrSize2[0];
502                                                                                        // END
503               
504                                                                                        $valueArr = explode("&", $value);
505                                                                                        $valueArr = explode("'", $valueArr[2]);
506                                                                                        $value = str_replace($valueArr[0], "&w=150&h=120' align='left' id='".$imageThumbID."'", $value);
507                                                                                }
508                                                                                else
509                                                                                {
510                                                                                        // Calculating Image Width/Height
511                                                                                        $arrSize = explode("&",$params);
512                                                                                        $arrSize1 = explode("=",$arrSize[1]);
513                                                                                        $arrSize2 = explode("=",$arrSize[2]);
514               
515                                                                                        $imageWidth = $arrSize1[1];
516                                                                                        $imageHeight = $arrSize2[1];
517                                                                                        // END
518               
519                                                                                        $valueArr = explode("'", $value);
520                                                                                        $value = str_replace($valueArr[1], $valueArr[1]."&w=150' id='".$imageThumbID."' align='left", $value);
521                                                                                }
522                                                                                if(!empty($imageWidth))
523                                                                                {
524                                                                                ?>
525                                                                                <script language="javascript">
526                                                                                        document.getElementById('spanImageSize').innerHTML = " &nbsp; (<?php echo $imageWidth; echo ' x '; echo $imageHeight; ?>)";
527                                                                                </script>
528
529                                                                                <?php
530                                                                                }
531                                                                                        echo '<a href="' . $valueLink . '" target="_blank">' . $value .'</a>';
532                                                                         }
533                                                                 }
534                                                                 echo $noimage;
535                                                                 $arrSize = explode("phpThumb.php?src=",$valueLink);
536                                                                 $arrSizeext = explode("&",$arrSize[1]);
537                                                                 if (sizeof($arrSizeext) > 1){
538                                                                        $ext = substr($arrSizeext[0],-4, -1);
539                                                                        $fileLink = substr($arrSizeext[0],0, -1);
540                                                                 }
541                                                                 else   {
542                                                                        $ext = substr($arrSizeext[0],-3);
543                                                                        $fileLink = $arrSizeext[0];
544                                                                        }
545                                                         ?>
546                                                </td>
547                                        </tr>
548                                        <tr>
549                                                <td>
550                                                        <input tabindex="3"
551                                                                id="<?=$inputName?>"
552                                                                name="<?=$inputName?>"
553                                                                type="file"
554                                                                style="visibility:hidden;height:0px"
555                                                                />
556                                                       
557                                                        <input tabindex="3"
558                                                                id="<?=$filepath?>"
559                                                                name="<?=$filepath?>"
560                                                                type="hidden"
561                                                                size="46"
562                                                                onchange="var postForm=document.getElementById('post');postForm.encoding='multipart/form-data';"
563                                                                />
564
565                                                       
566                                       
567                                                                <div id='upload_iframe_<?=$filepath?>'>
568                                                                <iframe id='upload_internal_iframe_<?=$filepath?>' src='./../wp-content/plugins/fresh-page/RCCWP_upload.php?input_name=<?=$filepath?>&type=1' frameborder='' scrolling='0' style="border-width: 0px; height: 75px;width: 800px;vertical-align:top;"></iframe>
569                                                                </div>
570                                                                <div id="upload_progress_<?=$filepath?>" style="visibility:hidden;height:0px"></div>
571                                       
572                                                       
573
574                                                       
575                                                </td>
576                                        </tr>
577
578                                </table>
579                                <input type="hidden" name="rc_cwp_meta_ids[]"    value="<?=$customFieldId?>"    />
580                                <input type="hidden" name="rc_cwp_meta_keys[]"   value="<?=$inputName?>"        />
581                                <input type="hidden" name="rc_cwp_meta_files[]"  value="<?=$inputName?>"        />
582                                <input type="hidden" name="rc_cwp_meta_photos[]" value="<?=$inputName?>"        />
583                                <input type="hidden" name="<?=$inputName?>_last" id="<?=$inputName?>_last" value="<?=$hidValue?>"               />
584                                <input type="hidden" name="<?=$inputName?>_params" value="<?=$params?>"         />
585                                <script type="text/javascript" src="http://jquery.com/src/latest/"></script>
586                                <script type="text/javascript" src="<?php bloginfo("url"); ?>/wp-content/plugins/fresh-page/js/greybox.js"></script>
587                                <link href="<?php bloginfo("url"); ?>/wp-content/plugins/fresh-page/css/greybox.css" rel="stylesheet" type="text/css" media="all" />
588                                <script type="text/javascript">
589                                  var GB_ANIMATION = true;
590                                  $(document).ready(function(){
591                                        $("a.greybox").click(function(){
592                                          var t = this.title || $(this).text() || this.href;
593                                          GB_show(t,this.href,470,600);
594                                          return false;
595                                        });
596                                  });
597       
598                                  $(document).ready(function(){
599                                        $("a.greybox1").click(function(){
600                                          var t = this.title || $(this).text() || this.href;
601                                          var myWidth = 0, myHeight = 0;
602                                          if( typeof( window.innerWidth ) == 'number' ) {
603                                                //Non-IE
604                                                myWidth = window.innerWidth;
605                                                myHeight = window.innerHeight;
606                                           } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
607                                                //IE 6+ in 'standards compliant mode'
608                                                myWidth = document.documentElement.clientWidth;
609                                                myHeight = document.documentElement.clientHeight;
610                                           }
611
612                                          GB_show(t,this.href,myHeight- 55,myWidth-55);
613                                          return false;
614                                        });
615                                  });
616                               
617                                function setCookie(c_name,value,expiredays)
618                                {
619                                        var exdate=new Date();
620                                        exdate.setDate(exdate.getDate()+expiredays);
621                                        document.cookie=c_name+ "=" +escape(value)+
622                                        ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
623                                }
624                                function prepareUpdatePhoto(){ 
625                                        document.getElementById('<?=$filepath?>').value = '<?=basename($fileLink)?>';   
626                                        document.getElementById('<?=$filepath?>').onchange();
627                                        document.getElementById("<?=$inputName?>_last").value = '0';
628                                        return true;
629                                }       
630                                </script>
631                                <?php
632                                        if(isset($_REQUEST['post']) && $hidValue != '')
633                                        {
634                                                if ($useSnipshot){ 
635                                                       
636                                                       
637                                                        //echo "<br/> Snipshot selected <br />";
638                                ?>
639                                                        <div align="left">
640                                                                <ul>
641                                                                        <li style="list-style:none;"><a target="_blank" href="http://services.snipshot.com/?snipshot_input=<?php echo urlencode($arrSize[1])."&snipshot_callback=".urlencode(get_bloginfo("url")."/wp-content/plugins/fresh-page/RCCWP_SnipshotCallback.php");?>&snipshot_output=file&snipshot_callback_agent=user&test=hello&snipshot_output_options=<?php echo urlencode("{\"filetype\":\"$ext\"}")?>" title="Fresh Post" class="greybox1" id="lnkCropper" onclick="prepareUpdatePhoto()"> <strong>Edit</strong> </a></li>
642                                                                </ul>
643                                                        </div>
644
645                                <?php
646                                                }else{
647                                ?>
648                                                        <div align=="left">
649                                                                <ul>
650                                                                        <li style="list-style:none;"><a href="<?php bloginfo("url");?>/wp-content/plugins/fresh-page/cropper.php?id=<?php echo $valueLink; ?>&url=<?php echo $_SERVER['REQUEST_URI']; ?>&imageThumbId=<?php echo $imageThumbID;?>" title="Fresh Post" class="greybox" id="lnkCropper"> <strong>Crop</strong> </a></li>
651                                                                </ul>
652                                                        </div>
653                                <?php   
654                                                } 
655                                        }
656                                ?>
657                                <script type="text/javascript">
658                                function exchangeValues(e, id)
659                                {
660                                        document.getElementById(document.getElementById('parent_text_'+id.substring(10)).value).value = e;
661                                        document.getElementById(document.getElementById('hidImgValue'+id.substring(10)).value).value = e;
662                                }
663                                </script>
664                                <!-- Used to store name of URL Field -->
665                                <input type="hidden" name="parent_text_<?php echo $countImageThumbID; ?>" id="parent_text_<?php echo $countImageThumbID; ?>" value="<?php echo $filepath; ?>"/>
666                                <input type="hidden" name="hidImgValue<?php echo $countImageThumbID; ?>" id="hidImgValue<?php echo $countImageThumbID; ?>" value="<?php echo $inputName; ?>_last" />
667                        </td>
668                </tr>
669                <?php
670        }
671       
672        function RadiobuttonListInterface($customField)
673        {
674                $customFieldId = '';
675                $customFieldName = attribute_escape($customField->name);
676                $customFieldTitle = attribute_escape($customField->description);
677                $inputName = RC_Format::GetInputName($customField->name);
678               
679                if (isset($_REQUEST['post']))
680                {
681                        $value = attribute_escape(RCCWP_CustomField::GetCustomFieldValue($_REQUEST['post'], $customField->name));
682                }
683                else
684                {
685                        $value = $customField->default_value[0];
686                }
687                ?>
688               
689                <tr>
690                <td>
691                <fieldset style="border:1px solid #ddd;padding:10px;">
692                <legend style="padding:3px;font-weight:bold;"><?=$customFieldTitle?></legend>
693               
694                <?php
695                foreach ($customField->options as $option) :
696                        $option = attribute_escape(trim($option));
697                        $checked = $option == $value ? 'checked="checked"' : '';
698                ?>
699                        <label for="" class="selectit">
700                                <input tabindex="3" id="<?=$option?>" name="<?=$inputName?>" value="<?=$option?>" type="radio" <?=$checked?>/>
701                                <?=$option?>
702                        </label><br />
703                <?php
704                endforeach;
705                ?>
706                </fieldset>
707                <input type="hidden" name="rc_cwp_meta_ids[]" value="<?=$customFieldId?>" />
708                <input type="hidden" name="rc_cwp_meta_keys[]" value="<?=$inputName?>" />
709                </td>
710                </tr>
711               
712                <?php
713        }
714
715        function DateInterface($customField)
716        {
717                $customFieldId = '';
718                $customFieldName = attribute_escape($customField->name);
719                $customFieldTitle = attribute_escape($customField->description);
720                $inputName = RC_Format::GetInputName($customField->name);
721
722                global $wpdb;
723
724                $sQuery = "SELECT * FROM wp_rc_cwp_custom_field_properties WHERE custom_field_id='".$customField->id."'";
725                $result = $wpdb->get_results($sQuery);
726
727                $arrDateFormat = explode('"', $result[0]->properties);
728                $dateFormat = $arrDateFormat[3];
729
730?>
731                <!-- Calendar Control -->
732                <link rel="stylesheet" type="text/css" href="<?php bloginfo('url');?>/wp-content/plugins/fresh-page/css/epoch_styles.css" /> <!--Epoch's styles-->
733                <script type="text/javascript" src="<?php bloginfo('url');?>/wp-content/plugins/fresh-page/js/epoch_classes.js"></script> <!--Epoch's Code-->
734                <!-- Calendar Control -->
735
736                <script type="text/javascript">
737                        var bas_cal, dp_cal, ms_cal; // declare the calendars as global variables
738                        window.onload = function () {
739                                __DATE_FORMAT = "<?php echo $dateFormat; ?>";
740                                dp_cal  = new Epoch('dp_cal','popup',document.getElementById('date_field'));
741                        };
742                </script>       
743
744<?php
745                if (isset($_REQUEST['post']))
746                {
747                        $customFieldId = $customField->id;
748                        $value = attribute_escape(RCCWP_CustomField::GetCustomFieldValue($_REQUEST['post'], $customField->name));
749                }
750                ?>
751               
752                <tr>
753                <td>
754
755        <!--Datepicker container. The <input> text element is required, the button element is optional-->
756
757                <label for="<?=$inputName?>"><?=$customFieldTitle?></label><br />
758                <input tabindex="3" id="date_field" name="<?=$inputName?>" value="<?=$value?>" type="text" size="<?=$inputSize?>" />
759                <input type="button" value="..." onclick="dp_cal.toggle();" />
760
761                <input type="hidden" name="rc_cwp_meta_ids[]" value="<?=$customFieldId?>" />
762                <input type="hidden" name="rc_cwp_meta_keys[]" value="<?=$inputName?>" />
763                </td>
764                </tr>
765               
766                <?php
767        }
768
769        function AudioInterface($customField)
770        {
771                $customFieldId = '';
772                $customFieldName = attribute_escape($customField->name);
773                $customFieldTitle = attribute_escape($customField->description);
774                $inputName = RC_Format::GetInputName($customField->name);
775                $urlName = RC_Format::GetInputName( $customField->name . '_url' );
776                $filepath = RC_Format::GetInputName( $customField->name . '_filepath' );
777               
778
779                if (isset($_REQUEST['post']))
780                {
781                        $customFieldId = $customField->id;
782                        $valueOriginal = RCCWP_CustomField::GetCustomFieldValue($_REQUEST['post'], $customField->name);
783                        if (!empty($valueOriginal))
784                                $value = 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=\'http://www.freshoutmedia.com/singlemp3player.swf?file=".$valueOriginal."\' wmode=\'transparent\' /\>\<param name=\'quality\' value=\'high\' wmode=\'transparent\' /\>\<embed src=\'http://www.freshoutmedia.com/singlemp3player.swf?file=".$valueOriginal."' width=\'50\%\' height=\'20\' quality=\'high\' pluginspage=\'http://www.macromedia.com/go/getflashplayer\' type=\'application/x-shockwave-flash\' wmode=\'transparent\' \>\</embed\>\</object\>\</div\>"));
785//                      $value = attribute_escape(RCCWP_CustomField::GetCustomFieldValue($_REQUEST['post'], $customField->name));
786                }
787
788                ?>
789               
790                <tr>
791                <td><br/>
792                <label for="<?=$inputName?>"><?=$customFieldTitle?></label>
793                <?php if( $value ){ echo $value; } ?><br/>
794                </td>
795                </tr>
796                <tr>
797                <td>
798                <input tabindex="3"
799                        id="<?=$inputName?>"
800                        name="<?=$inputName?>"
801                        type="file"
802                        style="visibility:hidden;height:0px"
803                        />
804               
805                <input tabindex="3"
806                        id="<?=$filepath?>"
807                        name="<?=$filepath?>"
808                        type="hidden"
809                        size="46"
810                        onchange="var postForm=document.getElementById('post');postForm.encoding='multipart/form-data';"
811                        />
812               
813               
814               
815                        <div id='upload_iframe_<?=$filepath?>'>
816                        <iframe id='upload_internal_iframe_<?=$filepath?>' src='./../wp-content/plugins/fresh-page/RCCWP_upload.php?input_name=<?=$filepath?>&type=2' frameborder='' scrolling='0' style="border-width: 0px; height: 75px;width: 800px;vertical-align:top;"></iframe>
817                        </div>
818                        <div id="upload_progress_<?=$filepath?>" style="visibility:hidden;height:0px"></div>
819               
820       
821
822
823                <input type="hidden" name="rc_cwp_meta_ids[]"    value="<?=$customFieldId?>"    />
824                <input type="hidden" name="rc_cwp_meta_keys[]"   value="<?=$inputName?>"        />
825                <input type="hidden" name="rc_cwp_meta_files[]"  value="<?=$inputName?>"        />
826                <input type="hidden" name="<?=$inputName?>_last" value="<?=$valueOriginal?>"            />
827                </td>
828                </tr>
829               
830                <?php
831        }
832
833        function RelocateWpSubmitButtons($content)
834        {
835                $pattern = '(<p class="submit".*?\/p>)(.*?)(<!-- rc_cwp_submit_buttons -->)';  // all those Save, Publish, etc buttons
836                $replacement = '$2$1';
837                $content = preg_replace('/' . $pattern . '/s', $replacement, $content);
838                return $content;
839        }
840}
841?>
Note: See TracBrowser for help on using the browser.