<?php return array('cleanup' => array('switch' => array('switch_not_available')), 'checks' => array('counter' => array('is_numeric', 'not_empty')), 'processor' => array('preupdate' => array(), 'postupdate' => array()), 'errors' => array('is_numeric' => __('Numberic value required.', pixlikes::textdomain()), 'not_empty' => __('Field is required.', pixlikes::textdomain())), 'callbacks' => array('switch_not_available' => 'pixlikes_cleanup_switch_not_available', 'is_numeric' => 'pixlikes_validate_is_numeric', 'not_empty' => 'pixlikes_validate_not_empty')); # config
/** * Sets a custom text domain; if null is passed the text domain will revert * to the default text domain. */ static function settextdomain($textdomain) { if (!empty($textdomain)) { self::$textdomain = $textdomain; } else { // null or otherwise empty value // revert to default self::$textdomain = 'pixlikes_txtd'; } }
<?php defined('ABSPATH') or die; $basepath = dirname(__FILE__) . DIRECTORY_SEPARATOR; $debug = false; if (isset($_GET['debug']) && $_GET['debug'] == 'true') { $debug = true; } return array('plugin-name' => 'pixlikes', 'settings-key' => 'pixlikes_settings', 'textdomain' => 'pixlikes_txtd', 'template-paths' => array($basepath . 'core/views/form-partials/', $basepath . 'views/form-partials/'), 'fields' => array('general' => include 'settings/general' . EXT, 'show_on' => include 'settings/show_on' . EXT, 'cache' => include 'settings/cache' . EXT), 'processor' => array('preupdate' => array(), 'postupdate' => array('save_settings')), 'cleanup' => array('switch' => array('switch_not_available')), 'checks' => array('counter' => array('is_numeric', 'not_empty')), 'errors' => array('not_empty' => __('Invalid Value.', pixlikes::textdomain())), 'callbacks' => array('save_settings' => 'save_pixlikes_settings'), 'github_updater' => array('slug' => 'pixlikes/pixlikes.php', 'api_url' => 'https://api.github.com/repos/pixelgrade/pixlikes', 'raw_url' => 'https://raw.github.com/pixelgrade/pixlikes/update', 'github_url' => 'https://github.com/pixelgrade/pixlikes/tree/update', 'zip_url' => 'https://github.com/pixelgrade/pixlikes/archive/update.zip', 'sslverify' => false, 'requires' => '3.0', 'tested' => '3.3', 'readme' => 'README.md', 'textdomain' => 'pixlikes', 'debug_mode' => $debug), 'debug' => $debug); # config
function pixlikes_edit_metabox($post) { // Add an nonce field so we can check for it later. wp_nonce_field('pixlikes_inner_custom_box', 'pixlikes_inner_custom_box_nonce'); $value = get_post_meta($post->ID, '_pixlikes', true); echo '<label for="edit_pixlikes">'; _e("Likes number: ", pixlikes::textdomain()); echo '</label> '; echo '<input type="text" id="edit_pixlikes" name="edit_pixlikes" value="' . esc_attr($value) . '" size="20" />'; }
<?php return array('type' => 'postbox', 'label' => __('Cache Settings', pixlikes::textdomain()), 'options' => array('load_likes_with_ajax' => array('label' => __('Reload likes number on page load', pixlikes::textdomain()), 'default' => false, 'description' > __('This helps you to prevent the likes number to be cached', pixlikes::textdomain()), 'type' => 'switch'))); # config