Example #1
0
    function axiom_add_fields_in_user_profile($user)
    {
        ?>
		<h3><?php 
        _e('User Position', 'axiom');
        ?>
</h3>
		<table class="form-table">
			<tr>
				<th><label for="user_position"><?php 
        _e('User position', 'axiom');
        ?>
:</label></th>
				<td><input type="text" name="user_position" id="user_position" size="55" value="<?php 
        echo esc_attr(get_the_author_meta('user_position', $user->ID));
        ?>
" />
					<span class="description"><?php 
        _e('Please, enter your position in the company', 'axiom');
        ?>
</span>
				</td>
			</tr>
		</table>
	
		<h3><?php 
        _e('Social links', 'axiom');
        ?>
</h3>
		<table class="form-table">
		<?php 
        $upload_info = wp_upload_dir();
        $upload_url = $upload_info['baseurl'];
        $social_list = axiom_get_theme_option('social_icons');
        foreach ($social_list as $soc) {
            $sn = basename($soc['icon']);
            //$sn = axiom_substr($sn, 0, axiom_strrpos($sn, '.'));
            $sn = axiom_substr($sn, axiom_strrpos($sn, '-') + 1);
            if (($pos = axiom_strrpos($sn, '_')) !== false) {
                $sn = axiom_substr($sn, 0, $pos);
            }
            ?>
			<tr>
				<th><label for="user_<?php 
            echo esc_attr($sn);
            ?>
"><?php 
            echo trim(axiom_strtoproper($sn));
            ?>
:</label></th>
				<td><input type="text" name="user_<?php 
            echo esc_attr($sn);
            ?>
" id="user_<?php 
            echo esc_attr($sn);
            ?>
" size="55" value="<?php 
            echo esc_attr(get_the_author_meta('user_' . $sn, $user->ID));
            ?>
" />
					<span class="description"><?php 
            echo sprintf(__('Please, enter your %s link', 'axiom'), axiom_strtoproper($sn));
            ?>
</span>
				</td>
			</tr>
			<?php 
        }
        ?>
		</table>
	<?php 
    }
Example #2
0
 function axiom_add_thumb_sizes($sizes)
 {
     global $AXIOM_GLOBALS;
     if (!isset($sizes['h_crop'])) {
         $sizes['h_crop'] = isset($sizes['h']) ? $sizes['h'] : null;
     }
     //if (empty($sizes['mode']))			$sizes['mode'] = 'blog';
     if (empty($sizes['thumb_title'])) {
         $sizes['thumb_title'] = axiom_strtoproper($sizes['layout']);
     }
     $thumb_slug = axiom_get_thumb_slug($sizes['thumb_title']);
     if (empty($AXIOM_GLOBALS['thumb_sizes'][$thumb_slug])) {
         if (empty($AXIOM_GLOBALS['thumb_sizes'])) {
             $AXIOM_GLOBALS['thumb_sizes'] = array();
         }
         $AXIOM_GLOBALS['thumb_sizes'][$thumb_slug] = $sizes;
         add_image_size($thumb_slug, $sizes['w'], $sizes['h'], $sizes['h'] != null);
         if ($sizes['h'] != $sizes['h_crop']) {
             // Uncomment this lines, if you want create separate entry for the cropped sizes (optional)
             //$sizes['h']=$sizes['h_crop'];
             //$sizes['title'] .= __(' (cropped)', 'axiom');
             //$AXIOM_GLOBALS['thumb_sizes'][$sizes['layout'].'_crop'] = $sizes;
             add_image_size($thumb_slug . '_crop', $sizes['w'], $sizes['h_crop'], true);
         }
     }
 }
Example #3
0
 function axiom_get_list_templates($mode = '')
 {
     global $AXIOM_GLOBALS;
     if (isset($AXIOM_GLOBALS['list_templates_' . $mode])) {
         $list = $AXIOM_GLOBALS['list_templates_' . $mode];
     } else {
         $list = array();
         foreach ($AXIOM_GLOBALS['registered_templates'] as $k => $v) {
             if ($mode == '' || axiom_strpos($v['mode'], $mode) !== false) {
                 $list[$k] = !empty($v['title']) ? $v['title'] : axiom_strtoproper($v['layout']);
             }
         }
         $AXIOM_GLOBALS['list_templates_' . $mode] = $list;
     }
     return $list;
 }
Example #4
0
    function build_page()
    {
        $subject = $message = $attach = $group = $sender_name = $sender_email = '';
        $subscribers_update = $subscribers_delete = $subscribers_clear = false;
        $subscribers = array();
        if (isset($_POST['emailer_subject'])) {
            do {
                // Check nonce
                if (!isset($_POST['nonce']) || !wp_verify_nonce($_POST['nonce'], __FILE__)) {
                    $this->error = __('Incorrect WP-nonce data! Operation canceled!', 'axiom');
                    break;
                }
                // Get post data
                $subject = isset($_POST['emailer_subject']) ? $_POST['emailer_subject'] : '';
                if (empty($subject)) {
                    $this->error = __('Subject can not be empty! Operation canceled!', 'axiom');
                    break;
                }
                $message = isset($_POST['emailer_message']) ? $_POST['emailer_message'] : '';
                if (empty($message)) {
                    $this->error = __('Message can not be empty! Operation canceled!', 'axiom');
                    break;
                }
                $attach = isset($_FILES['emailer_attachment']['tmp_name']) && file_exists($_FILES['emailer_attachment']['tmp_name']) ? $_FILES['emailer_attachment']['tmp_name'] : '';
                $group = isset($_POST['emailer_group']) ? $_POST['emailer_group'] : '';
                $subscribers = isset($_POST['emailer_subscribers']) ? $_POST['emailer_subscribers'] : '';
                if (!empty($subscribers)) {
                    $subscribers = explode("\n", str_replace(array(';', ','), array("\n", "\n"), $subscribers));
                } else {
                    $subscribers = array();
                }
                if (count($subscribers) == 0) {
                    $this->error = __('Subscribers lists are empty! Operation canceled!', 'axiom');
                    break;
                }
                $sender_name = !empty($_POST['emailer_sender_name']) ? $_POST['emailer_sender_name'] : get_bloginfo('name');
                $sender_email = !empty($_POST['emailer_sender_email']) ? $_POST['emailer_sender_email'] : '';
                if (empty($sender_email)) {
                    $sender_email = axiom_get_theme_option('contact_email');
                }
                if (empty($sender_email)) {
                    $sender_email = get_bloginfo('admin_email');
                }
                if (empty($sender_email)) {
                    $this->error = __('Sender email is empty! Operation canceled!', 'axiom');
                    break;
                }
                $headers = 'From: ' . $sender_name . ' <' . $sender_email . '>' . "\r\n";
                $subscribers_update = isset($_POST['emailer_subscribers_update']);
                $subscribers_delete = isset($_POST['emailer_subscribers_delete']);
                $subscribers_clear = isset($_POST['emailer_subscribers_clear']);
                // Send email
                add_filter('wp_mail_content_type', 'axiom_set_html_content_type');
                $new_list = array();
                $list = array();
                $cnt = 0;
                $mail = axiom_get_theme_option('mail_function');
                foreach ($subscribers as $email) {
                    $email = trim(chop($email));
                    if (empty($email)) {
                        continue;
                    }
                    if (!preg_match('/[\\.\\-_A-Za-z0-9]+?@[\\.\\-A-Za-z0-9]+?[\\ .A-Za-z0-9]{2,}/', $email)) {
                        continue;
                    }
                    $list[] = $email;
                    $cnt++;
                    if ($cnt >= $this->max_recipients_in_one_letter) {
                        @$mail($list, $subject, $message, $headers, $attach);
                        if ($subscribers_update && $group != 'none') {
                            $new_list = array_merge($new_list, $list);
                        }
                        $list = array();
                        $cnt = 0;
                    }
                }
                if ($cnt > 0) {
                    @$mail($list, $subject, $message, $headers, $attach);
                    if ($subscribers_update && $group != 'none') {
                        $new_list = array_merge($new_list, $list);
                    }
                    $list = array();
                    $cnt = 0;
                }
                remove_filter('wp_mail_content_type', 'axiom_set_html_content_type');
                $add_msg = '';
                if ($subscribers_update && $group != 'none') {
                    $rez = array();
                    if (count($this->subscribers[$group]) > 0) {
                        foreach ($this->subscribers[$group] as $k => $v) {
                            if (!$subscribers_clear && !empty($v)) {
                                $rez[$k] = $v;
                            }
                        }
                    }
                    if (count($new_list) > 0) {
                        foreach ($new_list as $v) {
                            $rez[$v] = '';
                        }
                    }
                    $this->subscribers[$group] = $rez;
                    update_option('axiom_emailer_subscribers', $this->subscribers);
                    $add_msg = __(' The subscriber list is updated', 'axiom');
                } else {
                    if ($subscribers_delete && $group != 'none') {
                        unset($this->subscribers[$group]);
                        update_option('axiom_emailer_subscribers', $this->subscribers);
                        $add_msg = __(' The subscriber list is cleared', 'axiom');
                    }
                }
                $this->success = __('E-Mail was send successfull!', 'axiom') . $add_msg;
            } while (false);
        }
        ?>
		<div class="trx_emailer">
			<h2 class="trx_emailer_title"><?php 
        _e('AxiomThemes Emailer', 'axiom');
        ?>
</h2>
			<div class="trx_emailer_result">
				<?php 
        if (!empty($this->error)) {
            ?>
				<div class="error">
					<p><?php 
            echo $this->error;
            ?>
</p>
				</div>
				<?php 
        }
        ?>
				<?php 
        if (!empty($this->success)) {
            ?>
				<div class="updated">
					<p><?php 
            echo $this->success;
            ?>
</p>
				</div>
				<?php 
        }
        ?>
			</div>
	
			<form id="trx_emailer_form" action="#" method="post" enctype="multipart/form-data">

				<input type="hidden" value="<?php 
        echo esc_attr($this->nonce);
        ?>
" name="nonce" />

				<div class="trx_emailer_block">
					<fieldset class="trx_emailer_block_inner">
						<legend> <?php 
        _e('Letter data', 'axiom');
        ?>
 </legend>
						<div class="trx_emailer_fields">
							<div class="trx_emailer_field trx_emailer_subject">
								<label for="emailer_subject"><?php 
        _e('Subject:', 'axiom');
        ?>
</label>
								<input type="text" value="<?php 
        echo esc_attr($subject);
        ?>
" name="emailer_subject" id="emailer_subject" />
							</div>
							<div class="trx_emailer_field trx_emailer_attachment">
								<label for="emailer_attachment"><?php 
        _e('Attachment:', 'axiom');
        ?>
</label>
								<input type="file" name="emailer_attachment" id="emailer_attachment" />
							</div>
							<div class="trx_emailer_field trx_emailer_message">
								<?php 
        wp_editor($message, 'emailer_message', array('wpautop' => false, 'textarea_rows' => 10));
        ?>
								
							</div>
						</div>
					</fieldset>
				</div>
	
				<div class="trx_emailer_block">
					<fieldset class="trx_emailer_block_inner">
						<legend> <?php 
        _e('Subscribers', 'axiom');
        ?>
 </legend>
						<div class="trx_emailer_fields">
							<div class="trx_emailer_field trx_emailer_group">
								<label for="emailer_group"><?php 
        _e('Select group:', 'axiom');
        ?>
</label>
								<select name="emailer_group" id="emailer_group">
									<option value="none"<?php 
        echo $group == 'none' ? ' selected="selected"' : '';
        ?>
><?php 
        _e('- Select group -', 'axiom');
        ?>
</option>
									<?php 
        if (count($this->subscribers) > 0) {
            foreach ($this->subscribers as $gr => $list) {
                echo '<option value="' . est_attr($gr) . '"' . ($group == $gr ? ' selected="selected"' : '') . '>' . axiom_strtoproper($gr) . '</option>';
            }
        }
        ?>
								</select>
								<input type="checkbox" name="emailer_subscribers_update" id="emailer_subscribers_update" value="1"<?php 
        echo $subscribers_update ? ' checked="checked"' : '';
        ?>
 /><label for="emailer_subscribers_update" class="inline" title="<?php 
        _e('Update the subscribers list for selected group', 'axiom');
        ?>
"><?php 
        _e('Update', 'axiom');
        ?>
</label>
								<input type="checkbox" name="emailer_subscribers_clear" id="emailer_subscribers_clear" value="1"<?php 
        echo $subscribers_clear ? ' checked="checked"' : '';
        ?>
 /><label for="emailer_subscribers_clear" class="inline" title="<?php 
        _e('Clear this group from not confirmed emails after send', 'axiom');
        ?>
"><?php 
        _e('Clear', 'axiom');
        ?>
</label>
								<input type="checkbox" name="emailer_subscribers_delete" id="emailer_subscribers_delete" value="1"<?php 
        echo $subscribers_delete ? ' checked="checked"' : '';
        ?>
 /><label for="emailer_subscribers_delete" class="inline" title="<?php 
        _e('Delete this group after send', 'axiom');
        ?>
"><?php 
        _e('Delete', 'axiom');
        ?>
</label>
							</div>
							<div class="trx_emailer_field trx_emailer_subscribers2">
								<label for="emailer_subscribers" class="big"><?php 
        _e('List of recipients:', 'axiom');
        ?>
</label>
								<textarea name="emailer_subscribers" id="emailer_subscribers"><?php 
        echo join("\n", $subscribers);
        ?>
</textarea>
							</div>
							<div class="trx_emailer_field trx_emailer_sender_name">
								<label for="emailer_sender_name"><?php 
        _e('Sender name:', 'axiom');
        ?>
</label>
								<input type="text" name="emailer_sender_name" id="emailer_sender_name" value="<?php 
        echo esc_attr($sender_name);
        ?>
" /><br />
							</div>
							<div class="trx_emailer_field trx_emailer_sender_email">
								<label for="emailer_sender_email"><?php 
        _e('Sender email:', 'axiom');
        ?>
</label>
								<input type="text" name="emailer_sender_email" id="emailer_sender_email" value="<?php 
        echo esc_attr($sender_email);
        ?>
" />
							</div>
						</div>
					</fieldset>
				</div>
	
				<div class="trx_emailer_buttons">
					<a href="#" id="trx_emailer_send"><?php 
        echo _e('Send', 'axiom');
        ?>
</a>
				</div>
	
			</form>
		</div>
		<?php 
    }
Example #5
0
    function axiom_team_show_meta_box()
    {
        global $post, $AXIOM_GLOBALS;
        // Use nonce for verification
        $data = get_post_meta($post->ID, 'team_data', true);
        $fields = $AXIOM_GLOBALS['team_meta_box']['fields'];
        ?>
		<input type="hidden" name="meta_box_team_nonce" value="<?php 
        echo wp_create_nonce(basename(__FILE__));
        ?>
" />
		<table class="team_area">
		<?php 
        foreach ($fields as $id => $field) {
            $meta = isset($data[$id]) ? $data[$id] : '';
            ?>
			<tr class="team_field <?php 
            echo esc_attr($field['class']);
            ?>
" valign="top">
				<td><label for="<?php 
            echo esc_attr($id);
            ?>
"><?php 
            echo esc_attr($field['title']);
            ?>
</label></td>
				<td>
					<?php 
            if ($id == 'team_member_socials') {
                $style = "icons";
                $upload_info = wp_upload_dir();
                $upload_url = $upload_info['baseurl'];
                $social_list = axiom_get_theme_option('social_icons');
                foreach ($social_list as $soc) {
                    $sn = basename($soc['icon']);
                    if ($style == 'icons') {
                        $sn = axiom_substr($sn, axiom_strrpos($sn, '-') + 1, strlen($sn) - axiom_strrpos($sn, '-'));
                    } else {
                        $sn = axiom_substr($sn, 0, axiom_strrpos($sn, '.'));
                    }
                    if (($pos = axiom_strrpos($sn, '_')) !== false) {
                        $sn = axiom_substr($sn, 0, $pos);
                    }
                    $link = isset($meta[$sn]) ? $meta[$sn] : '';
                    ?>
							<label for="<?php 
                    echo esc_attr($id . '_' . $sn);
                    ?>
"><?php 
                    echo esc_attr(axiom_strtoproper($sn));
                    ?>
</label><br>
							<input type="text" name="<?php 
                    echo esc_attr($id);
                    ?>
[<?php 
                    echo esc_attr($sn);
                    ?>
]" id="<?php 
                    echo esc_attr($id . '_' . $sn);
                    ?>
" value="<?php 
                    echo esc_attr($link);
                    ?>
" size="30" /><br>
							<?php 
                }
            } else {
                ?>
						<input type="text" name="<?php 
                echo esc_attr($id);
                ?>
" id="<?php 
                echo esc_attr($id);
                ?>
" value="<?php 
                echo esc_attr($meta);
                ?>
" size="30" />
						<?php 
            }
            ?>
					<br><small><?php 
            echo esc_attr($field['desc']);
            ?>
</small>
				</td>
			</tr>
			<?php 
        }
        ?>
		</table>
		<?php 
    }