Example #1
0
 function axiom_ini_get_values($file)
 {
     $rez = array();
     if (!is_array($file)) {
         if (file_exists($file)) {
             $file = axiom_fga($file);
         } else {
             return $rez;
         }
     }
     for ($i = 0; $i < count($file); $i++) {
         $file[$i] = trim(chop($file[$i]));
         if (($pos = axiom_strpos($file[$i], ';')) !== false) {
             $file[$i] = trim(axiom_substr($file[$i], 0, $pos));
         }
         $parts = explode('=', $file[$i]);
         if (count($parts) != 2) {
             continue;
         }
         $key = trim(chop($parts[0]));
         $rez[$key] = trim($parts[1]);
         if (axiom_substr($rez[$key], 0, 1) == '"') {
             $rez[$key] = axiom_substr($rez[$key], 1, axiom_strlen($rez[$key]) - 2);
         } else {
             $rez[$key] *= 1;
         }
     }
     return $rez;
 }
Example #2
0
 function axiom_date_to_sql($str)
 {
     if (trim($str) == '') {
         return '';
     }
     $str = strtr(trim($str), '/\\-,', '....');
     if (trim($str) == '00.00.0000' || trim($str) == '00.00.00') {
         return '';
     }
     $pos = axiom_strpos($str, '.');
     $d = trim(axiom_substr($str, 0, $pos));
     $str = axiom_substr($str, $pos + 1);
     $pos = axiom_strpos($str, '.');
     $m = trim(axiom_substr($str, 0, $pos));
     $y = trim(axiom_substr($str, $pos + 1));
     $y = $y < 50 ? $y + 2000 : ($y < 1900 ? $y + 1900 : $y);
     return '' . $y . '-' . (axiom_strlen($m) < 2 ? '0' : '') . $m . '-' . (axiom_strlen($d) < 2 ? '0' : '') . $d;
 }
Example #3
0
 function axiom_attachment_ajax_query_args($query)
 {
     if (isset($query['post_mime_type'])) {
         $v = $query['post_mime_type'];
         if (axiom_substr($v, 0, 13) == 'media_folder.') {
             unset($query['post_mime_type']);
             if (axiom_strlen($v) > 13) {
                 $query['media_folder'] = axiom_substr($v, 13);
             } else {
                 $list_ids = array();
                 $terms = axiom_get_terms_by_taxonomy('media_folder');
                 if (count($terms) > 0) {
                     foreach ($terms as $term) {
                         $list_ids[] = $term->term_id;
                     }
                 }
                 if (count($list_ids) > 0) {
                     $query['tax_query'] = array(array('taxonomy' => 'media_folder', 'field' => 'id', 'terms' => $list_ids, 'operator' => 'NOT IN'));
                 }
             }
         }
     }
     return $query;
 }
Example #4
0
 function axiom_strclear($text, $tags = array())
 {
     if (empty($text)) {
         return $text;
     }
     if (!is_array($tags)) {
         if ($tags != '') {
             $tags = explode($tags, ',');
         } else {
             $tags = array();
         }
     }
     $text = trim(chop($text));
     if (count($tags) > 0) {
         foreach ($tags as $tag) {
             $open = '<' . esc_attr($tag);
             $close = '</' . esc_attr($tag) . '>';
             if (axiom_substr($text, 0, axiom_strlen($open)) == $open) {
                 $pos = axiom_strpos($text, '>');
                 if ($pos !== false) {
                     $text = axiom_substr($text, $pos + 1);
                 }
             }
             if (axiom_substr($text, -axiom_strlen($close)) == $close) {
                 $text = axiom_substr($text, 0, axiom_strlen($text) - axiom_strlen($close));
             }
             $text = trim(chop($text));
         }
     }
     return $text;
 }
Example #5
0
function axiom_sc_twitter($atts, $content = null)
{
    if (axiom_sc_in_shortcode_blogger()) {
        return '';
    }
    extract(axiom_sc_html_decode(shortcode_atts(array("user" => "", "consumer_key" => "", "consumer_secret" => "", "token_key" => "", "token_secret" => "", "count" => "3", "controls" => "yes", "interval" => "", "autoheight" => "no", "align" => "", "bg_tint" => "", "bg_color" => "", "bg_image" => "", "bg_overlay" => "", "bg_texture" => "", "id" => "", "class" => "", "animation" => "", "css" => "", "width" => "", "height" => "", "top" => "", "bottom" => "", "left" => "", "right" => ""), $atts)));
    $twitter_username = $user ? $user : axiom_get_theme_option('twitter_username');
    $twitter_consumer_key = $consumer_key ? $consumer_key : axiom_get_theme_option('twitter_consumer_key');
    $twitter_consumer_secret = $consumer_secret ? $consumer_secret : axiom_get_theme_option('twitter_consumer_secret');
    $twitter_token_key = $token_key ? $token_key : axiom_get_theme_option('twitter_token_key');
    $twitter_token_secret = $token_secret ? $token_secret : axiom_get_theme_option('twitter_token_secret');
    $twitter_count = max(1, $count ? $count : intval(axiom_get_theme_option('twitter_count')));
    if (empty($id)) {
        $id = "sc_testimonials_" . str_replace('.', '', mt_rand());
    }
    if (empty($width)) {
        $width = "100%";
    }
    if (!empty($height) && axiom_sc_param_is_on($autoheight)) {
        $autoheight = "no";
    }
    if (empty($interval)) {
        $interval = mt_rand(5000, 10000);
    }
    if ($bg_image > 0) {
        $attach = wp_get_attachment_image_src($bg_image, 'full');
        if (isset($attach[0]) && $attach[0] != '') {
            $bg_image = $attach[0];
        }
    }
    if ($bg_overlay > 0) {
        if ($bg_color == '') {
            $bg_color = apply_filters('axiom_filter_get_theme_bgcolor', '');
        }
        $rgb = axiom_hex2rgb($bg_color);
    }
    $ms = axiom_get_css_position_from_values($top, $right, $bottom, $left);
    $ws = axiom_get_css_position_from_values('', '', '', '', $width);
    $hs = axiom_get_css_position_from_values('', '', '', '', '', $height);
    $css .= $ms . $hs . $ws;
    $output = '';
    if (!empty($twitter_consumer_key) && !empty($twitter_consumer_secret) && !empty($twitter_token_key) && !empty($twitter_token_secret)) {
        $data = axiom_get_twitter_data(array('mode' => 'user_timeline', 'consumer_key' => $twitter_consumer_key, 'consumer_secret' => $twitter_consumer_secret, 'token' => $twitter_token_key, 'secret' => $twitter_token_secret));
        if ($data && isset($data[0]['text'])) {
            axiom_enqueue_slider('swiper');
            $output = ($bg_color != '' || $bg_image != '' || $bg_overlay > 0 || $bg_texture > 0 || axiom_strlen($bg_texture) > 2 ? '<div class="sc_twitter_wrap sc_section' . ($bg_tint ? ' bg_tint_' . esc_attr($bg_tint) : '') . ($align && $align != 'none' && $align != 'inherit' ? ' align' . esc_attr($align) : '') . '"' . ' style="' . ($bg_color !== '' && $bg_overlay == 0 ? 'background-color:' . esc_attr($bg_color) . ';' : '') . ($bg_image !== '' ? 'background-image:url(' . esc_url($bg_image) . ');' : '') . '"' . (!axiom_sc_param_is_off($animation) ? ' data-animation="' . esc_attr(axiom_sc_get_animation_classes($animation)) . '"' : '') . '>' . '<div class="sc_section_overlay' . ($bg_texture > 0 ? ' texture_bg_' . esc_attr($bg_texture) : '') . '"' . ' style="' . ($bg_overlay > 0 ? 'background-color:rgba(' . (int) $rgb['r'] . ',' . (int) $rgb['g'] . ',' . (int) $rgb['b'] . ',' . min(1, max(0, $bg_overlay)) . ');' : '') . (axiom_strlen($bg_texture) > 2 ? 'background-image:url(' . esc_url($bg_texture) . ');' : '') . '"' . ($bg_overlay > 0 ? ' data-overlay="' . esc_attr($bg_overlay) . '" data-bg_color="' . esc_attr($bg_color) . '"' : '') . '>' : '') . '<div class="sc_twitter sc_slider_swiper sc_slider_nopagination swiper-slider-container"' . (axiom_sc_param_is_on($controls) ? ' sc_slider_controls' : ' sc_slider_nocontrols') . (axiom_sc_param_is_on($autoheight) ? ' sc_slider_height_auto' : '') . ($hs ? ' sc_slider_height_fixed' : '') . (!empty($class) ? ' ' . esc_attr($class) : '') . ($bg_color == '' && $bg_image == '' && $bg_overlay == 0 && ($bg_texture == '' || $bg_texture == '0') && $align && $align != 'none' && $align != 'inherit' ? ' align' . esc_attr($align) : '') . '"' . ($bg_color == '' && $bg_image == '' && $bg_overlay == 0 && ($bg_texture == '' || $bg_texture == '0') && !axiom_sc_param_is_off($animation) ? ' data-animation="' . esc_attr(axiom_sc_get_animation_classes($animation)) . '"' : '') . (!empty($width) && axiom_strpos($width, '%') === false ? ' data-old-width="' . esc_attr($width) . '"' : '') . (!empty($height) && axiom_strpos($height, '%') === false ? ' data-old-height="' . esc_attr($height) . '"' : '') . ((int) $interval > 0 ? ' data-interval="' . esc_attr($interval) . '"' : '') . ($css != '' ? ' style="' . esc_attr($css) . '"' : '') . '>' . '<div class="slides swiper-wrapper">';
            $cnt = 0;
            foreach ($data as $tweet) {
                if (axiom_substr($tweet['text'], 0, 1) == '@') {
                    continue;
                }
                $output .= '<div class="swiper-slide" data-style="' . esc_attr($ws . $hs) . '" style="' . esc_attr($ws . $hs) . '">' . '<div class="sc_twitter_item">' . '<span class="sc_twitter_icon icon-twitter"></span>' . '<div class="sc_twitter_content">' . '<a href="' . esc_url('https://twitter.com/' . $twitter_username) . '" class="sc_twitter_author" target="_blank">@' . esc_html($tweet['user']['screen_name']) . '</a> ' . force_balance_tags(axiom_prepare_twitter_text($tweet)) . '</div>' . '</div>' . '</div>';
                if (++$cnt >= $twitter_count) {
                    break;
                }
            }
            $output .= '</div>' . '<div class="sc_slider_controls_wrap"><a class="sc_slider_prev" href="#"></a><a class="sc_slider_next" href="#"></a></div>' . '</div>' . ($bg_color != '' || $bg_image != '' || $bg_overlay > 0 || $bg_texture > 0 || axiom_strlen($bg_texture) > 2 ? '</div></div>' : '');
        }
    }
    return apply_filters('axiom_shortcode_output', $output, 'trx_twitter', $atts, $content);
}
Example #6
0
 function replace_uploads($str)
 {
     if (is_array($str)) {
         foreach ($str as $k => $v) {
             $str[$k] = $this->replace_uploads($v);
         }
     } else {
         if (is_string($str)) {
             while (($pos = axiom_strpos($str, "/{$this->options['uploads_folder']}/")) !== false) {
                 $pos0 = $pos;
                 while ($pos0) {
                     if (axiom_substr($str, $pos0, 5) == 'http:') {
                         break;
                     }
                     $pos0--;
                 }
                 $str = ($pos0 > 0 ? axiom_substr($str, 0, $pos0) : '') . $this->uploads_url . axiom_substr($str, $pos + axiom_strlen($this->options['uploads_folder']) + 1);
             }
         }
     }
     return $str;
 }
Example #7
0
<?php

global $AXIOM_GLOBALS;
if (empty($AXIOM_GLOBALS['menu_user'])) {
    $AXIOM_GLOBALS['menu_user'] = axiom_get_nav_menu('menu_user');
}
if (empty($AXIOM_GLOBALS['menu_user'])) {
    ?>
	<ul id="menu_user" class="menu_user_nav">
    <?php 
} else {
    $menu = axiom_substr($AXIOM_GLOBALS['menu_user'], 0, axiom_strlen($AXIOM_GLOBALS['menu_user']) - 5);
    $pos = axiom_strpos($menu, '<ul');
    if ($pos !== false) {
        $menu = axiom_substr($menu, 0, $pos + 3) . axiom_substr($menu, $pos + 3);
    }
    echo str_replace('class=""', '', $menu);
}
?>

<?php 
if (axiom_is_woocommerce_page() && axiom_get_custom_option('show_currency') == 'yes') {
    ?>
	<li class="menu_user_currency">
		<a href="#">$</a>
		<ul>
			<li><a href="#"><b>&#36;</b> <?php 
    _e('Dollar', 'axiom');
    ?>
</a></li>
			<li><a href="#"><b>&euro;</b> <?php 
Example #8
0
    function axiom_template_accordion_output($post_options, $post_data)
    {
        ?>
		<div class="post_item sc_blogger_item sc_accordion_item<?php 
        echo $post_options['number'] == $post_options['posts_on_page'] && !axiom_sc_param_is_on($post_options['loadmore']) ? ' sc_blogger_item_last' : '';
        ?>
">
			
			<h5 class="post_title sc_title sc_blogger_title sc_accordion_title"><span class="sc_accordion_icon sc_accordion_icon_closed icon-plus-1"></span><span class="sc_accordion_icon sc_accordion_icon_opened icon-minus-1"></span><?php 
        echo $post_data['post_title'];
        ?>
</h5>
			
			<div class="post_content sc_accordion_content">
				<?php 
        if (axiom_sc_param_is_on($post_options['info'])) {
            ?>
					<div class="post_info">
						<span class="post_info_item post_info_posted_by"><?php 
            _e('Posted by', 'axiom');
            ?>
 <a href="<?php 
            echo esc_url($post_data['post_author_url']);
            ?>
" class="post_info_author"><?php 
            echo esc_html($post_data['post_author']);
            ?>
</a></span>
						<span class="post_info_item post_info_counters">
							<?php 
            echo $post_options['orderby'] == 'comments' || $post_options['counters'] == 'comments' ? __('Comments', 'axiom') : __('Views', 'axiom');
            ?>
							<span class="post_info_counters_number"><?php 
            echo $post_options['orderby'] == 'comments' || $post_options['counters'] == 'comments' ? $post_data['post_comments'] : $post_data['post_views'];
            ?>
</span>
						</span>
					</div>
					<?php 
        }
        if ($post_options['descr'] >= 0) {
            ?>
					<div class="post_descr">
					<?php 
            if (!in_array($post_data['post_format'], array('quote', 'link', 'chat')) && $post_options['descr'] > 0 && axiom_strlen($post_data['post_excerpt']) > $post_options['descr']) {
                $post_data['post_excerpt'] = axiom_strshort($post_data['post_excerpt'], $post_options['descr'], $post_options['readmore'] ? '' : '...');
            }
            echo $post_data['post_excerpt'];
            ?>
					</div>
					<?php 
        }
        if (empty($post_options['readmore'])) {
            $post_options['readmore'] = __('READ MORE', 'axiom');
        }
        if (!axiom_sc_param_is_off($post_options['readmore']) && !in_array($post_data['post_format'], array('quote', 'link', 'chat', 'aside', 'status'))) {
            echo do_shortcode('[trx_button link="' . esc_url($post_data['post_link']) . '"]' . $post_options['readmore'] . '[/trx_button]');
        }
        ?>
			
			</div>	<!-- /.post_content -->

		</div>		<!-- /.post_item -->

		<?php 
    }
Example #9
0
 function axiom_rgb2hex($rgb)
 {
     $hex = array(dechex($rgb['r']), dechex($rgb['g']), dechex($rgb['b']));
     return '#' . (axiom_strlen($hex[0]) == 1 ? '0' : '') . $hex[0] . (axiom_strlen($hex[1]) == 1 ? '0' : '') . $hex[1] . (axiom_strlen($hex[2]) == 1 ? '0' : '') . $hex[2];
 }
Example #10
0
    function axiom_reviews_get_markup($field, $value, $editable = false, $clear = false, $snippets = false)
    {
        $max_level = max(5, (int) axiom_get_custom_option('reviews_max_level'));
        $step = $max_level < 100 ? 0.1 : 1;
        $prec = pow(10, axiom_strpos($step, '.') === false ? 0 : axiom_strlen($step) - axiom_strpos($step, '.') - 1);
        $output = '<div class="reviews_editor">';
        $criterias = $field['options'];
        $marks = explode(',', $value);
        if (is_array($criterias) && count($criterias) > 0) {
            $i = 0;
            foreach ($criterias as $num => $sb) {
                if (empty($sb)) {
                    continue;
                }
                if ($clear || !isset($marks[$i]) || $marks[$i] == '' || axiom_is_inherit_option($marks[$i])) {
                    $marks[$i] = 0;
                }
                $marks[$i] = min($max_level, max(0, round($marks[$i] * $prec) / $prec + 0));
                $output .= '<div class="reviews_item reviews_max_level_' . esc_attr($max_level) . '" data-max-level="' . esc_attr($max_level) . '" data-step="' . esc_attr($step) . '">' . '<div class="reviews_criteria">' . $sb . '</div>' . trim(axiom_reviews_get_summary_stars($marks[$i], $editable)) . '</div>';
                $i++;
            }
        }
        $output .= '</div>';
        $output .= isset($field['accept']) && $field['accept'] ? '<div class="reviews_accept">' . do_shortcode('[trx_button]' . __('Accept your votes', 'axiom') . '[/trx_button]') . '</div>' : '';
        $avg = axiom_reviews_get_average_rating($value);
        $avg = min($max_level, max(0, round($avg * $prec) / $prec + 0));
        $output .= '
            <div class="reviews_summary">
				<div class="reviews_item reviews_max_level_' . esc_attr($max_level) . '" data-step="' . esc_attr($step) . '">
					<div class="reviews_criteria">' . (isset($field['descr']) ? $field['descr'] : __('Summary', 'axiom')) . '</div>
					' . trim(axiom_reviews_get_summary_stars($avg, false, $snippets)) . '
				</div>
            </div>
		';
        return $output;
    }
Example #11
0
 function axiom_get_first_url($post_text)
 {
     $src = '';
     if (($pos_start = axiom_strpos($post_text, 'http')) !== false) {
         for ($i = $pos_start; $i < axiom_strlen($post_text); $i++) {
             $ch = axiom_substr($post_text, $i, 1);
             if (axiom_strpos("< \n\"\\']", $ch) !== false) {
                 break;
             }
             $src .= $ch;
         }
     }
     return $src;
 }