Changeset 2069704
- Timestamp:
- 04/17/2019 04:10:39 AM (7 years ago)
- Location:
- wpr-admin-amplify/trunk
- Files:
-
- 3 edited
-
functions.php (modified) (2 diffs)
-
postmeta.php (modified) (4 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wpr-admin-amplify/trunk/functions.php
r1981664 r2069704 5 5 Plugin URI: http://worldpressrevolution.com 6 6 Description: User interface for creating custom posty types, custom fields, custom admin pages, forms ect... 7 Version: 1. 2.17 Version: 1.3.0 8 8 Author: Aryan Duntley 9 9 Author URI: http://worldpressrevolution.com … … 350 350 'label' => '', 351 351 'description' => '', 352 'default_value' => '<div style="background: #EFEFEF"><p><ul style="list-style-type:disc;"><li><pre style="margin: 0px;padding: 0px;display: inline-block;background:#fff;">apply_filters("wpr_postmeta_argsedit", $margs);</pre><br/>You can send a custom array of data available throughout the class<ol><li>$margs are any custom arguments passed (which should be none, the UI does not use this).</li></ol></li><li><pre style="margin: 0px;padding: 0px;display: inline-block;background:#fff;">apply_filters("wpr_postmeta_myownthing", true, $this->pagesadded_met, $post, $xargs);</pre><br/>Executed at the beginning of the callback for add_meta_box().<ol><li>@p1 bool: representing whether to continue executing code from this point on. If false, nothing will happen after this point and code will rely on whatever you do here.</li><li>@p2 array: is array of all data sent to the class including all field data for the meta box.</li><li>@p3 global post object.</li><li>@p4 array: any custom arguments that were sent to the class or hooked.</li></ol></li><li><pre style="margin: 0px;padding: 0px;display: inline-block;background:#fff;">do_action("wpr_postmeta_myfield", $post_ob_name, $value, $metabox, $post, $this->pagesadded_met, $xargs);</pre><br/>A switch statement is used to traverse through the various field types. The default field type is blank and this hook is placed there. You can create your own field types using this hook along with the "wpr_postmeta_saving_call" if needed.<ol><li>@p1 string: is the post name that will be sent via http post when the form is saved. It is consists of the general post name and the key ie "postname[keyid]" wher keyid is the id of the field you created.</li><li>@p2 array: This is not named very well, but oh well. This is actually the string indexed array of all the field parameters (id, title, name, desc, std, etc...) .</li><li>@p3 string|array: This is the value of the meta field, or the $value["std"] (default value) if the meta field has not yet been created.</li><li>@p4 The global post object.</li><li>@p5 array: All the class variables</li><li>@p6 array: any custom array data set by you.</li></ol></li><li><pre style="margin: 0px;padding: 0px;display: inline-block;background:#fff;">do_action("wpr_postmeta_afterfield", $post_ob_name, $value, $metabox, $post, $this->pagesadded_met, $xargs);</pre><br/>This is called after the field has been created. Do whatever you want here. <ol><li>Exact same params as "wpr_postmeta_myfield" above.</li></ol></li><li><pre style="margin: 0px;padding: 0px;display: inline-block;background:#fff;">do_action("wpr_postmeta_afterfields", $post_ob_name, $post, $this->pagesadded_met, $xargs);</pre><br/>This is called after all fields have been created.<ol><li>@p1 string: post name (same as above two)</li><li>$p2 global post object</li><li>@p3 array: class params same as above two</li><li>@p4 array: additional args same as above 2.</li></ol></li><li><pre style="margin: 0px;padding: 0px;display: inline-block;background:#fff;">apply_filters("wpr_postmeta_saving_call", true, $_POST[$this->pagesadded_met["postnm"]], $this->pagesadded_met, $post_id);</pre><br/>This is called right after the post has been saved. You can let the typical saving do it\'s thing or you can do your own thing then let the code run, or you can do you own thing and stop the code from running. Return true to continue running the rest of the saving code, return false if you have done your own thing in the hook and do not want the code to continue running. You should test the params to make sure that you are grabbing the correct stuff. This hook can prevent any meta fields from getting saved at all so use carefully.<ol><li>@p1 bool: continue with following code or no.</li><li>@p2 array: the entire posted array from the save post form.</li><li>@p3 array: the class params</li><li>@p4 int: the post id.</li></ol></li><li><pre style="margin: 0px;padding: 0px;display: inline-block;background:#fff;">apply_filters("wpr_postmeta_saving_one", true, $post_id, $dpname, $dpval, $_POST[$this->pagesadded_met["postnm"]], $this->pagesadded_met);</pre><br/>This is within a loop that iterates through the post array from the form. You can control individual post elements here. Return true to run the rest of the code (update_post_meta()) or false to not.<ol><li>@p1 bool: whether to continue with updating the post meta for this particular meta field.</li><li>@p2 int: the post id.</li><li>@p3 string: the post name.</li><li>@p4 string: the post value.</li><li>@p5 array: the entire meta post array from the form (only meta box fields part of it)</li><li>@p6 array: the class params</li></ol></li></ul></p></div>', 352 'default_value' => '<div style="background: #EFEFEF"><p><ul style="list-style-type:disc;"> 353 <li><pre style="margin: 0px;padding: 0px;display: inline-block;background:#fff;">apply_filters("wpr_postmeta_fullargsedit", $this->pagesadded_met);</pre><br/>You can modify the array of values sent to the add metabox function<ol><li>$this->pagesadded_met is an array of data describing the meta box.</li><li><pre>function customFilterArgsXYZ($args){<br/>for($i=0;$i<count($args["fields"]);$i++){<br/>if($args["fields"][$i]["id"] == "sponsorthiseventdesc"){/* This is the id you set when creating the custom meta box */<br/>$args["fields"][$i]["std"] = $def;/* default value */<br/>$args["fields"][$i]["placeholder"] = $def;/* placeholder */<br/>$args["fields"][$i]["title"] = $def;/* title */<br/>$args["fields"][$i]["desc"] = $def;/* description */<br/>/* any other fields should probably not be modified, you could break the functionality of saving the data */<br/>}<br/>}<br/>return $args;<br/>}<br/>add_filter("wpr_postmeta_fullargsedit", "customFilterArgsXYZ", 10);</pre></li></ol></li><li><pre style="margin: 0px;padding: 0px;display: inline-block;background:#fff;">apply_filters("wpr_postmeta_argsedit", $margs);</pre><br/>You can send a custom array of data available throughout the class<ol><li>$margs are any custom arguments passed (which should be none, the UI does not use this).</li></ol></li><li><pre style="margin: 0px;padding: 0px;display: inline-block;background:#fff;">apply_filters("wpr_postmeta_myownthing", true, $this->pagesadded_met, $post, $xargs);</pre><br/>Executed at the beginning of the callback for add_meta_box().<ol><li>@p1 bool: representing whether to continue executing code from this point on. If false, nothing will happen after this point and code will rely on whatever you do here.</li><li>@p2 array: is array of all data sent to the class including all field data for the meta box.</li><li>@p3 global post object.</li><li>@p4 array: any custom arguments that were sent to the class or hooked.</li></ol></li><li><pre style="margin: 0px;padding: 0px;display: inline-block;background:#fff;">do_action("wpr_postmeta_myfield", $post_ob_name, $value, $metabox, $post, $this->pagesadded_met, $xargs);</pre><br/>A switch statement is used to traverse through the various field types. The default field type is blank and this hook is placed there. You can create your own field types using this hook along with the "wpr_postmeta_saving_call" if needed.<ol><li>@p1 string: is the post name that will be sent via http post when the form is saved. It is consists of the general post name and the key ie "postname[keyid]" wher keyid is the id of the field you created.</li><li>@p2 array: This is not named very well, but oh well. This is actually the string indexed array of all the field parameters (id, title, name, desc, std, etc...) .</li><li>@p3 string|array: This is the value of the meta field, or the $value["std"] (default value) if the meta field has not yet been created.</li><li>@p4 The global post object.</li><li>@p5 array: All the class variables</li><li>@p6 array: any custom array data set by you.</li></ol></li><li><pre style="margin: 0px;padding: 0px;display: inline-block;background:#fff;">do_action("wpr_postmeta_afterfield", $post_ob_name, $value, $metabox, $post, $this->pagesadded_met, $xargs);</pre><br/>This is called after the field has been created. Do whatever you want here. <ol><li>Exact same params as "wpr_postmeta_myfield" above.</li></ol></li><li><pre style="margin: 0px;padding: 0px;display: inline-block;background:#fff;">do_action("wpr_postmeta_afterfields", $post_ob_name, $post, $this->pagesadded_met, $xargs);</pre><br/>This is called after all fields have been created.<ol><li>@p1 string: post name (same as above two)</li><li>$p2 global post object</li><li>@p3 array: class params same as above two</li><li>@p4 array: additional args same as above 2.</li></ol></li><li><pre style="margin: 0px;padding: 0px;display: inline-block;background:#fff;">apply_filters("wpr_postmeta_saving_call", true, $_POST[$this->pagesadded_met["postnm"]], $this->pagesadded_met, $post_id);</pre><br/>This is called right after the post has been saved. You can let the typical saving do it\'s thing or you can do your own thing then let the code run, or you can do you own thing and stop the code from running. Return true to continue running the rest of the saving code, return false if you have done your own thing in the hook and do not want the code to continue running. You should test the params to make sure that you are grabbing the correct stuff. This hook can prevent any meta fields from getting saved at all so use carefully.<ol><li>@p1 bool: continue with following code or no.</li><li>@p2 array: the entire posted array from the save post form.</li><li>@p3 array: the class params</li><li>@p4 int: the post id.</li></ol></li><li><pre style="margin: 0px;padding: 0px;display: inline-block;background:#fff;">apply_filters("wpr_postmeta_saving_one", true, $post_id, $dpname, $dpval, $_POST[$this->pagesadded_met["postnm"]], $this->pagesadded_met);</pre><br/>This is within a loop that iterates through the post array from the form. You can control individual post elements here. Return true to run the rest of the code (update_post_meta()) or false to not.<ol><li>@p1 bool: whether to continue with updating the post meta for this particular meta field.</li><li>@p2 int: the post id.</li><li>@p3 string: the post name.</li><li>@p4 string: the post value.</li><li>@p5 array: the entire meta post array from the form (only meta box fields part of it)</li><li>@p6 array: the class params</li></ol></li></ul></p></div>', 353 354 ), 354 355 ) -
wpr-admin-amplify/trunk/postmeta.php
r1151615 r2069704 20 20 'fields' => $fields, 21 21 ); 22 $this->pagesadded_met = apply_filters('wpr_postmeta_fullargsedit', $this->pagesadded_met); 22 23 $this->pagesadded_met['xargs'] = apply_filters('wpr_postmeta_argsedit', $margs); 23 24 add_action('admin_menu', array( $this, 'add_paga_metabox')); … … 209 210 </div> 210 211 <div style="float:left;width:75%;"> 211 <input id="<?php echo $value['id']; ?>" class="met_<?php echo $value['type']; ?>" type="text" size="120" name="<?php echo $postarr . '[' . $value['id'] . ']'; ?>" value="<?php echo $metabox; ?>" <?php if($value['decimal'] && $value['decimal'] == 'true'){ ?>onkeyup="if(/\D/g.test(this.value)){this.value = this.value.replace(/\D/g,'');}" <?php } ?> placeholder="<?php echo isset($ field["placeholder"])?$field["placeholder"]:""; ?>"/>212 <input id="<?php echo $value['id']; ?>" class="met_<?php echo $value['type']; ?>" type="text" size="120" name="<?php echo $postarr . '[' . $value['id'] . ']'; ?>" value="<?php echo $metabox; ?>" <?php if($value['decimal'] && $value['decimal'] == 'true'){ ?>onkeyup="if(/\D/g.test(this.value)){this.value = this.value.replace(/\D/g,'');}" <?php } ?> placeholder="<?php echo isset($value["placeholder"])?$value["placeholder"]:""; ?>"/> 212 213 </div> 213 214 <br class="clear" /> … … 239 240 ?> 240 241 <div class="metabox" style="display:block;width:100%;padding:10px;"> 241 <div class=" text" style="float:left;width:70%;">242 <label for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?></label> 243 <p class="description"><?php echo $value['desc']; ?></p> 244 </div> 245 <div style=" float:left;width:75%;">242 <div class="chck" style="float:left; margin-right: 10px"> 243 <label for="<?php echo $value['id']; ?>"><?php echo $value['name']; ?></label> 244 <p class="description"><?php echo $value['desc']; ?></p> 245 </div> 246 <div style="display: inline-block; position: relative; top: 5px;"> 246 247 <input class="checkersbox" type="checkbox" value="<?php echo $metabox; ?>" data-on="<?php echo $dars[1]; ?>" data-off="<?php echo $dars[2]; ?>" <?php echo $ischk; ?> > 247 248 <input id="<?php echo $value['id']; ?>" class="met_<?php echo $value['type']; ?> checkshadow" type="hidden" name="<?php echo $postarr . '[' . $value['id'] . ']'; ?>" value="<?php echo $metabox; ?>" /> … … 357 358 </div> 358 359 <div style="float:left;width:90%;"> 359 <textarea id="<?php echo $value['id']; ?>" class="<?php echo $value['id']; ?>" type="text" name="<?php echo $postarr . '[' . $value['id'] . ']'; ?>" placeholder="<?php echo isset($ field["placeholder"])?$field["placeholder"]:""; ?>"><?php echo $metabox; ?></textarea>360 <textarea id="<?php echo $value['id']; ?>" class="<?php echo $value['id']; ?>" type="text" name="<?php echo $postarr . '[' . $value['id'] . ']'; ?>" placeholder="<?php echo isset($value["placeholder"])?$value["placeholder"]:""; ?>"><?php echo $metabox; ?></textarea> 360 361 </div> 361 362 <br class="clear" /> -
wpr-admin-amplify/trunk/readme.txt
r1981664 r2069704 7 7 Tags: membership, restricted content, protected content, custom post type, custom options page, custom fields, custom taxonomy, custom categories, custom post meta, custom forms, 8 8 Requires at least: 3.0.1 9 Tested up to: 4.9.810 Stable tag: 1. 2.19 Tested up to: 5.1.1 10 Stable tag: 1.3.0 11 11 License: GPLv2 or later 12 12 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 127 127 * Fixed a bug. 128 128 129 = 1.3.0 = 130 131 * Aded a new hook allowing control of args sent to create meta box 129 132 130 133
Note: See TracChangeset
for help on using the changeset viewer.