| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | // Flutter paths |
|---|
| 4 | require_once "RCCWP_Constant.php"; |
|---|
| 5 | /* |
|---|
| 6 | preg_match('/wp-content(.*)(RCCWP_EditnPlace\.php)$/',__FILE__,$flutterpath); |
|---|
| 7 | $flutterpath = str_replace('\\', '/', $flutterpath); |
|---|
| 8 | define(FLUTTER_PATH, str_replace('/RCCWP_EditnPlace.php', '', str_replace('\\', '/', __FILE__))); |
|---|
| 9 | define(FLUTTER_URI, get_bloginfo('wpurl').'/wp-content'.$flutterpath[1]); //returns "http://127.0.0.1/wp-content/plugins/Flutter/" |
|---|
| 10 | define(FLUTTER_URI_RELATIVE, 'wp-content'.$flutterpath[1]); //returns "wp-content/plugins/Flutter/" |
|---|
| 11 | */ |
|---|
| 12 | |
|---|
| 13 | class RCCWP_EditnPlace |
|---|
| 14 | { |
|---|
| 15 | |
|---|
| 16 | function EditnHeader (){ |
|---|
| 17 | global $post, $wp_version; |
|---|
| 18 | |
|---|
| 19 | // Is EIP enabled? |
|---|
| 20 | include_once('RCCWP_Options.php'); |
|---|
| 21 | $enableEditnplace = RCCWP_Options::Get('enable-editnplace'); |
|---|
| 22 | if (0 == $enableEditnplace) return; |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | $post_id = $post->ID; |
|---|
| 26 | |
|---|
| 27 | $FLUTTER_URI = FLUTTER_URI; |
|---|
| 28 | $nicedit_path = FLUTTER_URI."js/nicEdit.js"; |
|---|
| 29 | $prototype_path = FLUTTER_URI."js/prototype.js"; |
|---|
| 30 | $editnplace_path = FLUTTER_URI."js/editnplace.js"; |
|---|
| 31 | $arrow_image_path = FLUTTER_URI."images/arrow.gif"; |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | if ( is_user_logged_in() && |
|---|
| 35 | current_user_can('edit_posts', $post_id) |
|---|
| 36 | ){ |
|---|
| 37 | |
|---|
| 38 | echo <<<EOD |
|---|
| 39 | |
|---|
| 40 | <script language="JavaScript" type="text/javascript" > |
|---|
| 41 | var JS_FLUTTER_URI = '$FLUTTER_URI'; |
|---|
| 42 | </script> |
|---|
| 43 | <script type="text/javascript" src="$nicedit_path"></script> |
|---|
| 44 | <script type="text/javascript" src="$prototype_path"></script> |
|---|
| 45 | <script type="text/javascript" src="$editnplace_path"></script> |
|---|
| 46 | |
|---|
| 47 | <style type="text/css"> |
|---|
| 48 | |
|---|
| 49 | /*<![CDATA[*/ |
|---|
| 50 | |
|---|
| 51 | #savingDiv{ |
|---|
| 52 | font-size: medium; |
|---|
| 53 | font-weight: bold; |
|---|
| 54 | } |
|---|
| 55 | |
|---|
| 56 | .EIP_title:hover, .EIP_content:hover, |
|---|
| 57 | .EIP_textbox:hover, .EIP_mulittextbox:hover { |
|---|
| 58 | background-color: #FFFFCC; |
|---|
| 59 | } |
|---|
| 60 | |
|---|
| 61 | .EIPSaveCancel{ |
|---|
| 62 | padding: 5px; |
|---|
| 63 | margin-top: -1px; |
|---|
| 64 | z-index: 1000; |
|---|
| 65 | border-color:#CCC; |
|---|
| 66 | border-width:1px; |
|---|
| 67 | border-style:solid; |
|---|
| 68 | background-color:white; |
|---|
| 69 | position:fixed; |
|---|
| 70 | top:0px !important; |
|---|
| 71 | width:100% !important; |
|---|
| 72 | left: 0px !important; |
|---|
| 73 | /*position:absolute; |
|---|
| 74 | padding-top:2px; |
|---|
| 75 | padding-bottom:2px; |
|---|
| 76 | z-index: 1000;*/ |
|---|
| 77 | } |
|---|
| 78 | |
|---|
| 79 | .EIPSaveStatus{ |
|---|
| 80 | position:absolute; |
|---|
| 81 | font-size: 14px; |
|---|
| 82 | z-index: 1000; |
|---|
| 83 | } |
|---|
| 84 | |
|---|
| 85 | .EIPnicPanelDiv{ |
|---|
| 86 | position: absolute; |
|---|
| 87 | background-image: url($arrow_image_path); |
|---|
| 88 | width:154px; |
|---|
| 89 | height:38px; |
|---|
| 90 | z-index: 1000; |
|---|
| 91 | } |
|---|
| 92 | |
|---|
| 93 | div.nicEdit-panel{ |
|---|
| 94 | background-color: white !important; |
|---|
| 95 | width:140px !important; |
|---|
| 96 | } |
|---|
| 97 | |
|---|
| 98 | div.nicEdit-panelContain{ |
|---|
| 99 | background-color: white !important; |
|---|
| 100 | border-bottom: 0px !important; |
|---|
| 101 | border-left: 0px !important; |
|---|
| 102 | border-right: 0px !important; |
|---|
| 103 | width: 92% !important; |
|---|
| 104 | margin-left: 2px !important; |
|---|
| 105 | margin-top: 1px !important; |
|---|
| 106 | } |
|---|
| 107 | |
|---|
| 108 | .nicEdit-selected{ |
|---|
| 109 | /*background-color: #FFFFCC !important;*/ |
|---|
| 110 | border: thin inset !important; |
|---|
| 111 | padding: 10px; |
|---|
| 112 | } |
|---|
| 113 | .nicEdit-button { |
|---|
| 114 | background-color: white !important; |
|---|
| 115 | border: 0px !important; |
|---|
| 116 | } |
|---|
| 117 | |
|---|
| 118 | /*]]>*/ |
|---|
| 119 | |
|---|
| 120 | </style> |
|---|
| 121 | |
|---|
| 122 | EOD; |
|---|
| 123 | } |
|---|
| 124 | } |
|---|
| 125 | |
|---|
| 126 | |
|---|
| 127 | } |
|---|
| 128 | |
|---|
| 129 | |
|---|
| 130 | function EIP_title(){ |
|---|
| 131 | global $post; |
|---|
| 132 | $post_id = $post->ID; |
|---|
| 133 | echo " EIP_title "." EIP_postid$post_id "; |
|---|
| 134 | } |
|---|
| 135 | |
|---|
| 136 | function EIP_content(){ |
|---|
| 137 | global $post; |
|---|
| 138 | $post_id = $post->ID; |
|---|
| 139 | echo " EIP_content "." EIP_postid$post_id "; |
|---|
| 140 | } |
|---|
| 141 | |
|---|
| 142 | function EIP_textbox($meta_id){ |
|---|
| 143 | global $post; |
|---|
| 144 | $post_id = $post->ID; |
|---|
| 145 | return " EIP_textbox "." EIP_postid$post_id "." EIP_mid_".$meta_id; |
|---|
| 146 | } |
|---|
| 147 | |
|---|
| 148 | function EIP_mulittextbox($meta_id){ |
|---|
| 149 | global $post; |
|---|
| 150 | $post_id = $post->ID; |
|---|
| 151 | return " EIP_mulittextbox "." EIP_postid$post_id "." EIP_mid_".$meta_id; |
|---|
| 152 | } |
|---|
| 153 | |
|---|
| 154 | |
|---|
| 155 | |
|---|
| 156 | ?> |
|---|