function test_wskl_get_from_assoc() { $assoc_var = array('key01' => 'Espresso', 'key02' => '1503', 'key03' => 'http://www.example.com/?topping=cream'); $this->assertEquals(wskl_get_from_assoc($assoc_var, 'key01'), 'Espresso'); $this->assertEquals(wskl_get_from_assoc($assoc_var, 'key01', 'absint'), 0); $this->assertEquals(wskl_get_from_assoc($assoc_var, 'key02', 'absint'), 1503); $this->assertEquals(wskl_get_from_assoc($assoc_var, 'key03', 'esc_url'), esc_url($assoc_var['key03'])); $this->assertEquals(wskl_get_from_assoc($assoc_var, 'key999', '', 'default-value'), 'default-value'); }
public static function shortcode_dabory_members($attrs, $content) { $param = wskl_get_from_assoc($attrs, 0); $output = ''; switch ($param) { case 'withdrawal': if (wskl_is_option_enabled('members_enable_withdrawal_shortcode')) { $output = WSKL_Dabory_Members_Withdrawal::output_form($content); } break; default: _doing_it_wrong(__FUNCTION__, "parameter '{$param}' is not recognized.", WSKL_VERSION); } return $output; }
public static function get_recipient_address($recipient) { if ($recipient instanceof WP_User) { return "\"{$recipient->display_name}\" <{$recipient->user_email}>"; } else { if (is_array($recipient)) { $name = wskl_get_from_assoc($recipient, 'name'); $addr = wskl_get_from_assoc($recipient, 'addr'); if ($name) { return "\"{$name}\" <{$addr}>"; } else { return $addr; } } } return $recipient; }
echo esc_url($_SERVER['REQUEST_URI']); ?> "> <?php wp_nonce_field($nonce_action, $nonce_param); ?> <p> <?php echo wskl_get_from_assoc($settings, 'desc'); ?> </p> <?php foreach ($settings['sections'] as $section) { ?> <h2><?php echo wskl_get_from_assoc($section, 'title'); ?> </h2> <div> <?php if (isset($section['fields'])) { ?> <ul> <?php foreach ($section['fields'] as $field) { call_user_func($output_func, $field); } ?> </ul> <?php }
function wskl_REQUEST($key_name, $sanitize = '', $default = '') { return wskl_get_from_assoc($_REQUEST, $key_name, $sanitize, $default); }
?> </th> <th><?php _e('휴면 처리', 'wskl'); ?> </th> </tr> </thead> <tbody> <?php foreach ($recent_jobs as $jobs) { $timestamp = wskl_get_from_assoc($jobs, 'timestamp'); $total_notified = wskl_get_from_assoc($jobs, 'total_notified'); $total_disabled = wskl_get_from_assoc($jobs, 'total_disabled'); $notification_spent = wskl_get_from_assoc($jobs, 'notification_spent'); $deactivation_spent = wskl_get_from_assoc($jobs, 'deactivation_spent'); ?> <tr> <td><?php echo wskl_datetime_string($timestamp); ?> </td> <td><?php printf(_n('%s명', '%s명', $total_notified, 'wskl'), $total_notified); ?> <?php printf('(%.03fms)', $notification_spent * 1000); ?> </td> <td><?php
/** * @callback user_register * @action wpmem_post_register_data * * @param array $fields * - ID: user's ID * - display_name * - nickname * - user_email * - user_nicename * - username * - password * - user_registered * - user_role * - wpmem_reg_ip * - wpmem_reg_url */ public function trigger_customer_new_account($fields) { $phase = 'customer-new-account'; $default_roles = apply_filters('dabory_sms_customer_new_account_user_role', array('customer')); $user_role = wskl_get_from_assoc($fields, 'user_role'); if (!in_array($user_role, $default_roles)) { $user_id = wskl_get_from_assoc($fields, 'ID'); $username = wskl_get_from_assoc($fields, 'username'); $this->log("User role of {$username}(#{$user_id}) is {$user_role}. The role is not listed to send a message.", __METHOD__); return; } if (!$this->trigger_common(NULL, $fields['ID'], $phase)) { $this->log("'Trigger for '{$phase}' finished unsuccessfully.", __METHOD__); } }
<ul> <li> 상태: <?php if (isset($metadata['exported'])) { _e('내보내짐.', 'wskl'); } else { _e('아직 내보내지 않음.', 'wskl'); } ?> </li> <?php if (isset($metadata['exported'])) { ?> <li> <?php $exported = wskl_get_from_assoc($metadata, 'exported'); if ($exported) { printf('%s: %s', __('보낸 시각', 'wskl'), date_i18n(get_option('date_format'), $exported)); } else { _e('정확한 시각을 알 수 없습니다.', 'wskl'); } ?> </li> <?php } ?> </ul> </p> </div> </div>
public function output_fields($field) { if (!isset($field['type'])) { return; } $type = wskl_get_from_assoc($field, 'type'); $key = $this->get_option_name($field['key']); switch ($type) { case 'input': wskl_members_input($key, $field['label'], $field['desc'], $field['attrs'], $field['default']); break; case 'checkbox': wskl_members_checkbox($key, $field['label'], $field['desc']); break; case 'page_select': wskl_members_page_select_tag($key, $field['label'], $field['desc']); break; case 'role_select': wskl_members_role_select_tag($key, $field['label'], $field['desc']); break; case 'role_checkbox': $role_exclude = isset($field['role_exclude']) ? $field['role_exclude'] : array(); wskl_members_role_check_tag($key, $field['label'], $field['desc'], $role_exclude); break; case 'select': wskl_members_select_tag($key, $field['label'], $field['desc']); break; default: do_action("wskl_wp_members_field_{$type}", $field); } }