Skip to content

Commit 26e3ed6

Browse files
committed
Strings updated
1 parent 90d495a commit 26e3ed6

File tree

5 files changed

+19
-28
lines changed

5 files changed

+19
-28
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ Go through the files in `/lib/` and `/src/`. First one contains classes for extr
3737

3838
`/lib/script.php` :: `PLUGIN_SCRIPT` to add required CSS and JS.
3939

40-
`/lib/cron.php` :: `PLUGIN_CRON` to add cron actions and callbacks.
41-
4240
### `/src` Files
4341

4442
`/src/install.php` :: `PLUGIN_INSTALL` to handle activation process.
@@ -52,3 +50,5 @@ Go through the files in `/lib/` and `/src/`. First one contains classes for extr
5250
`/src/metabox.php` :: `PLUGIN_METABOX` to add custom metabox in editor screen.
5351

5452
`/src/shortcode.php`:: `PLUGIN_SHORTCODE` to add and display shortcodes.
53+
54+
`/src/query.php`:: `PLUGIN_QUERY` to use post and user query. It uses `wp_pagenavi()` for breadceumbs

asset/ln/plugin.pot

Whitespace-only changes.

autoload.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ public function __construct() {
229229
add_action('init', array($this, 'custom_cron_hook_cb'));
230230

231231
$this->scripts();
232-
233232
$this->widgets();
234233
$this->metabox();
235234
$this->shortcode();

src/install.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ public function execute() {
3535
//Load plugin textdomain
3636
public function text_domain_cb() {
3737

38+
$locale = is_admin() && function_exists('get_user_locale') ? get_user_locale() : get_locale();
39+
$locale = apply_filters('plugin_locale', $locale, $this->textDomin);
40+
41+
unload_textdomain($this->textDomin);
42+
load_textdomain($this->textDomin, PLUGIN_LN . 'quize-custom-ads-' . $locale . '.mo');
3843
load_plugin_textdomain( $this->textDomin, false, PLUGIN_LN );
3944
}
4045

@@ -75,4 +80,4 @@ public function menu_page_link( $links, $file ) {
7580
}
7681
}
7782
}
78-
} ?>
83+
} ?>

src/metabox.php

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ public function register() {
3636

3737
public function render() {
3838

39-
wp_nonce_field( basename( __FILE__ ), 'metaBoxName_nonce' ); ?>
39+
wp_nonce_field( basename( __FILE__ ), 'metabox_name_nonce' ); ?>
4040

4141
<p>
42-
<label for="metaBoxName"><?php _e( "Custom Text", 'myPlugintextDomain' ); ?></label>
42+
<label for="metabox_name"><?php _e( "Custom Text", 'textdomain' ); ?></label>
4343
<br />
44-
<input class="widefat" type="text" name="metaBoxFieldName" id="metaBoxFieldName" value="<?php echo esc_attr( get_post_meta( $object->ID, 'metaBoxName', true ) ); ?>" />
44+
<input class="widefat" type="text" name="metabox_field_name" id="metabox_field_name" value="<?php echo esc_attr( get_post_meta( $object->ID, 'metabox_name', true ) ); ?>" />
4545
</p>
4646
<?php
4747
}
@@ -51,34 +51,21 @@ public function render() {
5151
//Save the post data
5252
function save( $post_id, $post ) {
5353

54+
//Check if doing autosave
55+
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;
56+
5457
//Verify the nonce before proceeding.
55-
if ( !isset( $_POST['metaBoxName_nonce'] ) || !wp_verify_nonce( $_POST['metaBoxName_nonce'], basename( __FILE__ ) ) )
56-
return $post_id;
58+
if ( !isset( $_POST['metabox_name_nonce'] ) || !wp_verify_nonce( $_POST['metabox_name_nonce'], basename( __FILE__ ) ) ) return;
5759

5860
//Get the post type object.
5961
$post_type = get_post_type_object( $post->post_type );
6062

6163
//Check if the current user has permission to edit the post.
62-
if ( !current_user_can( $post_type->cap->edit_post, $post_id ) )
63-
return $post_id;
64-
65-
//Get the posted data and sanitize it for use as an HTML class.
66-
$new_meta_value = ( isset( $_POST['metaBoxName'] ) ? sanitize_html_class( $_POST['metaBoxName'] ) : '' );
67-
68-
//Get the meta key.
69-
$meta_key = 'metaBoxName';
70-
71-
//Get the meta value of the custom field key.
72-
$meta_value = get_post_meta( $post_id, $meta_key, true );
64+
if ( !current_user_can( $post_type->cap->edit_post, $post_id ) ) return $post_id;
7365

74-
//If a new meta value was added and there was no previous value, add it.
75-
if ( $new_meta_value && '' == $meta_value ) {
76-
add_post_meta( $post_id, $meta_key, $new_meta_value, true );
77-
} elseif ( $new_meta_value && $new_meta_value != $meta_value ) {
78-
update_post_meta( $post_id, $meta_key, $new_meta_value );
79-
} elseif ( '' == $new_meta_value && $meta_value ) {
80-
delete_post_meta( $post_id, $meta_key, $meta_value );
66+
if ( isset( $_POST['metabox_field_name'] ) ) {
67+
update_post_meta( $post_id, 'metabox_field_name', esc_attr($_POST['metabox_field_name']) );
8168
}
8269
}
8370
}
84-
} ?>
71+
} ?>

0 commit comments

Comments
 (0)