function axiom_options_settings_theme_setup2() { if (axiom_options_is_used()) { global $AXIOM_GLOBALS; // Replace arrays with actual parameters $lists = array(); foreach ($AXIOM_GLOBALS['options'] as $k => $v) { if (isset($v['options']) && is_array($v['options'])) { foreach ($v['options'] as $k1 => $v1) { if (axiom_substr($k1, 0, 7) == '$axiom_' || axiom_substr($v1, 0, 7) == '$axiom_') { $list_func = axiom_substr(axiom_substr($k1, 0, 7) == '$axiom_' ? $k1 : $v1, 1); unset($AXIOM_GLOBALS['options'][$k]['options'][$k1]); if (isset($lists[$list_func])) { $AXIOM_GLOBALS['options'][$k]['options'] = axiom_array_merge($AXIOM_GLOBALS['options'][$k]['options'], $lists[$list_func]); } else { if (function_exists($list_func)) { $AXIOM_GLOBALS['options'][$k]['options'] = $lists[$list_func] = axiom_array_merge($AXIOM_GLOBALS['options'][$k]['options'], $list_func == 'axiom_get_list_menus' ? $list_func(true) : $list_func()); } else { echo sprintf(__('Wrong function name %s in the theme options array', 'axiom'), $list_func); } } } } } } } }
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; }
function axiom_template_portfolio_add_scripts($style) { if (axiom_substr($style, 0, 10) == 'portfolio_' || axiom_substr($style, 0, 5) == 'grid_' || axiom_substr($style, 0, 7) == 'square_') { axiom_enqueue_script('isotope', axiom_get_file_url('js/jquery.isotope.min.js'), array(), null, true); axiom_enqueue_script('hoverdir', axiom_get_file_url('js/hover/jquery.hoverdir.js'), array(), null, true); axiom_enqueue_style('axiom-portfolio-style', axiom_get_file_url('css/core.portfolio.css'), array(), null); } }
function axiom_core_customizer_add_custom_styles($custom_style) { // Custom fonts if (axiom_get_custom_option('typography_custom') == 'yes') { $fonts = axiom_get_list_fonts(false); $fname = axiom_get_custom_option('typography_p_font'); if (isset($fonts[$fname])) { $fstyle = explode(',', axiom_get_custom_option('typography_p_style')); $fname2 = ($pos = axiom_strpos($fname, ' (')) !== false ? axiom_substr($fname, 0, $pos) : $fname; $i = in_array('i', $fstyle); $u = in_array('u', $fstyle); $c = axiom_get_custom_option('typography_p_color'); $custom_style .= "\n\t\t\t\t\tbody, button, input, select, textarea {\n\t\t\t\t\t\tfont-family: '" . esc_attr($fname2) . "'" . (isset($fonts[$fname]['family']) ? ", " . esc_attr($fonts[$fname]['family']) : '') . ";\n\t\t\t\t\t}\n\t\t\t\t\tbody {\n\t\t\t\t\t\tfont-size: " . esc_attr(axiom_get_custom_option('typography_p_size')) . "px;\n\t\t\t\t\t\tfont-weight: " . esc_attr(axiom_get_custom_option('typography_p_weight')) . ";\n\t\t\t\t\t\tline-height: " . esc_attr(axiom_get_custom_option('typography_p_lineheight')) . "px;\n\t\t\t\t\t\t" . ($c ? "color: " . esc_attr($c) . ";" : '') . "\n\t\t\t\t\t\t" . ($i ? "font-style: italic;" : '') . "\n\t\t\t\t\t\t" . ($u ? "text-decoration: underline;" : '') . "\n\t\t\t\t\t}\n\t\t\t\t"; } for ($h = 1; $h <= 6; $h++) { $fname = axiom_get_custom_option('typography_h' . $h . '_font'); if (isset($fonts[$fname])) { $fstyle = explode(',', axiom_get_custom_option('typography_h' . $h . '_style')); $fname2 = ($pos = axiom_strpos($fname, ' (')) !== false ? axiom_substr($fname, 0, $pos) : $fname; $i = in_array('i', $fstyle); $u = in_array('u', $fstyle); $c = axiom_get_custom_option('typography_h' . $h . '_color'); $custom_style .= "\n\t\t\t\t\t\th" . intval($h) . ", .h" . intval($h) . " {\n\t\t\t\t\t\t\tfont-family: '" . esc_attr($fname2) . "'" . (isset($fonts[$fname]['family']) ? ", " . esc_attr($fonts[$fname]['family']) : '') . ";\n\t\t\t\t\t\t\tfont-size: " . esc_attr(axiom_get_custom_option('typography_h' . intval($h) . '_size')) . "px;\n\t\t\t\t\t\t\tfont-weight: " . esc_attr(axiom_get_custom_option('typography_h' . intval($h) . '_weight')) . ";\n\t\t\t\t\t\t\tline-height: " . esc_attr(axiom_get_custom_option('typography_h' . intval($h) . '_lineheight')) . "px;\n\t\t\t\t\t\t\t" . ($c ? "color: " . esc_attr($c) . ";" : '') . "\n\t\t\t\t\t\t\t" . ($i ? "font-style: italic;" : '') . "\n\t\t\t\t\t\t\t" . ($u ? "text-decoration: underline;" : '') . "\n\t\t\t\t\t\t}\n\t\t\t\t\t\th" . $h . " a, .h" . $h . " a {\n\t\t\t\t\t\t\t" . ($c ? "color: " . esc_attr($c) . ";" : '') . "\n\t\t\t\t\t\t}\n\t\t\t\t\t"; } } } // Submenu width $menu_width = axiom_get_theme_option('menu_width'); if (!empty($menu_width)) { $custom_style .= "\n\t\t\t\t/* Submenu width */\n\t\t\t\t.menu_main_wrap .menu_main_nav > li ul {\n\t\t\t\t\twidth: " . intval($menu_width) . "px;\n\t\t\t\t}\n\t\t\t\t.menu_main_wrap .menu_main_nav > li > ul ul {\n\t\t\t\t\tleft:" . intval($menu_width + 4) . "px;\n\t\t\t\t}\n\t\t\t\t.menu_main_wrap .menu_main_nav > li > ul ul.submenu_left {\n\t\t\t\t\tleft:-" . intval($menu_width + 1) . "px;\n\t\t\t\t}\n\t\t\t"; } // Logo height $logo_height = axiom_get_custom_option('logo_height'); if (!empty($logo_height)) { $custom_style .= "\n\t\t\t\t/* Logo header height */\n\t\t\t\t.menu_main_wrap .logo_main {\n\t\t\t\t\theight:" . intval($logo_height) . "px;\n\t\t\t\t}\n\t\t\t"; } // Logo top offset $logo_offset = axiom_get_custom_option('logo_offset'); if (!empty($logo_offset)) { $custom_style .= "\n\t\t\t\t/* Logo header top offset */\n\t\t\t\t.menu_main_wrap .logo {\n\t\t\t\t\tmargin-top:" . intval($logo_offset) . "px;\n\t\t\t\t}\n\t\t\t"; } // Logo footer height $logo_height = axiom_get_theme_option('logo_footer_height'); if (!empty($logo_height)) { $custom_style .= "\n\t\t\t\t/* Logo footer height */\n\t\t\t\t.contacts_wrap .logo img {\n\t\t\t\t\theight:" . intval($logo_height) . "px;\n\t\t\t\t}\n\t\t\t"; } // Custom css from theme options $custom_style .= axiom_get_custom_option('custom_css'); return $custom_style; }
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; }
/** * How to display the widget on the screen. */ function widget($args, $instance) { extract($args); /* Our variables from the widget settings. */ $title = apply_filters('widget_title', isset($instance['title']) ? $instance['title'] : ''); $twitter_username = isset($instance['twitter_username']) ? $instance['twitter_username'] : ''; $twitter_consumer_key = isset($instance['twitter_consumer_key']) ? $instance['twitter_consumer_key'] : ''; $twitter_consumer_secret = isset($instance['twitter_consumer_secret']) ? $instance['twitter_consumer_secret'] : ''; $twitter_token_key = isset($instance['twitter_token_key']) ? $instance['twitter_token_key'] : ''; $twitter_token_secret = isset($instance['twitter_token_secret']) ? $instance['twitter_token_secret'] : ''; $twitter_count = isset($instance['twitter_count']) ? $instance['twitter_count'] : ''; if (empty($twitter_consumer_key) || empty($twitter_consumer_secret) || empty($twitter_token_key) || empty($twitter_token_secret)) { return; } $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'])) { return; } $output = '<ul>'; $cnt = 0; foreach ($data as $tweet) { if (axiom_substr($tweet['text'], 0, 1) == '@') { continue; } $output .= '<li class="theme_text' . ($cnt == $twitter_count - 1 ? ' last' : '') . '"><a href="' . esc_url('https://twitter.com/' . $twitter_username) . '" class="username" target="_blank">@' . $tweet['user']['screen_name'] . '</a> ' . force_balance_tags(axiom_prepare_twitter_text($tweet)) . '</li>'; if (++$cnt >= $twitter_count) { break; } } $output .= '</ul>'; if (!empty($output)) { /* Before widget (defined by themes). */ echo $before_widget; /* Display the widget title if one was input (before and after defined by themes). */ echo $before_title . $title . $after_title; echo $output; /* After widget (defined by themes). */ echo $after_widget; } }
function axiom_callback_registration_user() { global $_REQUEST; if (!wp_verify_nonce($_REQUEST['nonce'], 'ajax_nonce')) { die; } $user_name = axiom_substr($_REQUEST['user_name'], 0, 20); $user_email = axiom_substr($_REQUEST['user_email'], 0, 60); $user_pwd = axiom_substr($_REQUEST['user_pwd'], 0, 20); $response = array('error' => ''); $id = wp_insert_user(array('user_login' => $user_name, 'user_pass' => $user_pwd, 'user_email' => $user_email)); if (is_wp_error($id)) { $response['error'] = $id->get_error_message(); } else { if (($notify = axiom_get_theme_option('notify_about_new_registration')) != 'no' && (($contact_email = axiom_get_theme_option('contact_email')) || ($contact_email = axiom_get_theme_option('admin_email')))) { $mail = axiom_get_theme_option('mail_function'); if (in_array($notify, array('both', 'admin', 'yes'))) { $subj = sprintf(__('Site %s - New user registration: %s', 'axiom'), esc_html(get_bloginfo('site_name')), esc_html($user_name)); $msg = "\n" . __('New registration:', 'axiom') . "\n" . __('Name:', 'axiom') . ' ' . esc_html($user_name) . "\n" . __('E-mail:', 'axiom') . ' ' . esc_html($user_email) . "\n\n............ " . esc_html(get_bloginfo('site_name')) . " (" . esc_html(home_url()) . ") ............"; $head = "Content-Type: text/plain; charset=\"utf-8\"\n" . "X-Mailer: PHP/" . phpversion() . "\n" . "Reply-To: " . sanitize_text_field($user_email) . "\n" . "To: " . sanitize_text_field($contact_email) . "\n" . "From: " . sanitize_text_field($user_email) . "\n" . "Subject: " . sanitize_text_field($subj) . "\n"; @$mail($contact_email, $subj, $msg, $head); } if (in_array($notify, array('both', 'user', 'yes'))) { $subj = sprintf(__('Welcome to "%s"', 'axiom'), get_bloginfo('site_name')); $msg = "\n" . __('Your registration data:', 'axiom') . "\n" . __('Name:', 'axiom') . ' ' . esc_html($user_name) . "\n" . __('E-mail:', 'axiom') . ' ' . esc_html($user_email) . "\n" . __('Password:'******'axiom') . ' ' . esc_html($user_pwd) . "\n\n............ " . esc_html(get_bloginfo('site_name')) . " (<a href=\"" . esc_url(home_url()) . "\">" . esc_html(home_url()) . "</a>) ............"; $head = "Content-Type: text/plain; charset=\"utf-8\"\n" . "X-Mailer: PHP/" . phpversion() . "\n" . "Reply-To: " . sanitize_text_field($contact_email) . "\n" . "To: " . sanitize_text_field($user_email) . "\n" . "From: " . sanitize_text_field($contact_email) . "\n" . "Subject: " . sanitize_text_field($subj) . "\n"; @$mail($user_email, $subj, $msg, $head); } } } echo json_encode($response); die; }
function axiom_sc_zoom($atts, $content = null) { if (axiom_sc_in_shortcode_blogger()) { return ''; } extract(axiom_sc_html_decode(shortcode_atts(array("effect" => "zoom", "src" => "", "url" => "", "over" => "", "align" => "", "bg_image" => "", "bg_top" => '', "bg_bottom" => '', "bg_left" => '', "bg_right" => '', "id" => "", "class" => "", "animation" => "", "css" => "", "width" => "", "height" => "", "top" => "", "bottom" => "", "left" => "", "right" => ""), $atts))); axiom_enqueue_script('axiom-elevate-zoom-script', axiom_get_file_url('js/jquery.elevateZoom-3.0.4.js'), array(), null, true); $css .= axiom_get_css_position_from_values('!' . $top, '!' . $right, '!' . $bottom, '!' . $left); $css_dim = axiom_get_css_position_from_values('', '', '', '', $width, $height); $css_bg = axiom_get_css_paddings_from_values($bg_top, $bg_right, $bg_bottom, $bg_left); $width = axiom_prepare_css_value($width); $height = axiom_prepare_css_value($height); if (empty($id)) { $id = 'sc_zoom_' . str_replace('.', '', mt_rand()); } $src = $src != '' ? $src : $url; if ($src > 0) { $attach = wp_get_attachment_image_src($src, 'full'); if (isset($attach[0]) && $attach[0] != '') { $src = $attach[0]; } } if ($over > 0) { $attach = wp_get_attachment_image_src($over, 'full'); if (isset($attach[0]) && $attach[0] != '') { $over = $attach[0]; } } if ($effect == 'lens' && ((int) $width > 0 && axiom_substr($width, -2, 2) == 'px') || (int) $height > 0 && axiom_substr($height, -2, 2) == 'px') { if ($src) { $src = axiom_get_resized_image_url($src, (int) $width > 0 && axiom_substr($width, -2, 2) == 'px' ? (int) $width : null, (int) $height > 0 && axiom_substr($height, -2, 2) == 'px' ? (int) $height : null); } if ($over) { $over = axiom_get_resized_image_url($over, (int) $width > 0 && axiom_substr($width, -2, 2) == 'px' ? (int) $width : null, (int) $height > 0 && axiom_substr($height, -2, 2) == 'px' ? (int) $height : null); } } 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_image) { $css_bg .= $css . 'background-image: url(' . esc_url($bg_image) . ');'; $css = $css_dim; } else { $css .= $css_dim; } $output = empty($src) ? '' : (!empty($bg_image) ? '<div class="sc_zoom_wrap' . (!empty($class) ? ' ' . esc_attr($class) : '') . ($align && $align != 'none' ? ' align' . esc_attr($align) : '') . '"' . (!axiom_sc_param_is_off($animation) ? ' data-animation="' . esc_attr(axiom_sc_get_animation_classes($animation)) . '"' : '') . ($css_bg != '' ? ' style="' . esc_attr($css_bg) . '"' : '') . '>' : '') . '<div' . ($id ? ' id="' . esc_attr($id) . '"' : '') . ' class="sc_zoom' . (empty($bg_image) && !empty($class) ? ' ' . esc_attr($class) : '') . (empty($bg_image) && $align && $align != 'none' ? ' align' . esc_attr($align) : '') . '"' . (empty($bg_image) && !axiom_sc_param_is_off($animation) ? ' data-animation="' . esc_attr(axiom_sc_get_animation_classes($animation)) . '"' : '') . ($css != '' ? ' style="' . esc_attr($css) . '"' : '') . '>' . '<img src="' . esc_url($src) . '"' . ($css_dim != '' ? ' style="' . esc_attr($css_dim) . '"' : '') . ' data-zoom-image="' . esc_url($over) . '" alt="" />' . '</div>' . (!empty($bg_image) ? '</div>' : ''); return apply_filters('axiom_shortcode_output', $output, 'trx_zoom', $atts, $content); }
function axiom_core_frontend_scripts() { global $wp_styles, $AXIOM_GLOBALS; // Enqueue styles //----------------------------------------------------------------------------------------------------- // Prepare custom fonts $fonts = axiom_get_list_fonts(false); $theme_fonts = array(); if (axiom_get_custom_option('typography_custom') == 'yes') { $selectors = array('p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'); foreach ($selectors as $s) { $font = axiom_get_custom_option('typography_' . $s . '_font'); if (!empty($font)) { $theme_fonts[$font] = 1; } } } // Prepare current skin fonts $theme_fonts = apply_filters('axiom_filter_used_fonts', $theme_fonts); // Link to selected fonts foreach ($theme_fonts as $font => $v) { if (isset($fonts[$font])) { $font_name = ($pos = axiom_strpos($font, ' (')) !== false ? axiom_substr($font, 0, $pos) : $font; $css = !empty($fonts[$font]['css']) ? $fonts[$font]['css'] : 'http://fonts.googleapis.com/css?family=' . (!empty($fonts[$font]['link']) ? $fonts[$font]['link'] : str_replace(' ', '+', $font_name) . ':100,100italic,300,300italic,400,400italic,700,700italic') . (empty($fonts[$font]['link']) || axiom_strpos($fonts[$font]['link'], 'subset=') === false ? '&subset=latin,latin-ext,cyrillic,cyrillic-ext' : ''); axiom_enqueue_style('theme-font-' . str_replace(' ', '-', $font_name), $css, array(), null); } } // Fontello styles must be loaded before main stylesheet axiom_enqueue_style('axiom-fontello-style', axiom_get_file_url('css/fontello/css/fontello.css'), array(), null); //axiom_enqueue_style( 'axiom-fontello-animation-style', axiom_get_file_url('css/fontello/css/animation.css'), array(), null); // Main stylesheet axiom_enqueue_style('axiom-main-style', get_stylesheet_uri(), array(), null); if (axiom_get_theme_option('debug_mode') == 'no' && axiom_get_theme_option('packed_scripts') == 'yes' && file_exists(axiom_get_file_dir('css/__packed.css'))) { // Load packed styles axiom_enqueue_style('axiom-packed-style', axiom_get_file_url('css/__packed.css'), array(), null); } else { // Shortcodes axiom_enqueue_style('axiom-shortcodes-style', axiom_get_file_url('shortcodes/shortcodes.css'), array(), null); // Animations if (axiom_get_theme_option('css_animation') == 'yes') { axiom_enqueue_style('axiom-animation-style', axiom_get_file_url('css/core.animation.css'), array(), null); } } // Theme skin stylesheet do_action('axiom_action_add_styles'); // Theme customizer stylesheet and inline styles axiom_enqueue_custom_styles(); // Responsive if (axiom_get_theme_option('responsive_layouts') == 'yes') { axiom_enqueue_style('axiom-responsive-style', axiom_get_file_url('css/responsive.css'), array(), null); do_action('axiom_action_add_responsive'); if (axiom_get_custom_option('theme_skin') != '') { $css = apply_filters('axiom_filter_add_responsive_inline', ''); if (!empty($css)) { wp_add_inline_style('axiom-responsive-style', $css); } } } // Enqueue scripts //---------------------------------------------------------------------------------------------------------------------------- if (axiom_get_theme_option('debug_mode') == 'no' && axiom_get_theme_option('packed_scripts') == 'yes' && file_exists(axiom_get_file_dir('js/__packed.js'))) { // Load packed theme scripts axiom_enqueue_script('axiom-packed-scripts', axiom_get_file_url('js/__packed.js'), array('jquery'), null, true); } else { // Load separate theme scripts axiom_enqueue_script('superfish', axiom_get_file_url('js/superfish.min.js'), array('jquery'), null, true); if (axiom_get_theme_option('menu_slider') == 'yes') { axiom_enqueue_script('axiom-slidemenu-script', axiom_get_file_url('js/jquery.slidemenu.js'), array('jquery'), null, true); //axiom_enqueue_script( 'axiom-jquery-easing-script', axiom_get_file_url('js/jquery.easing.js'), array('jquery'), null, true ); } // Load this script only if any shortcode run //axiom_enqueue_script( 'axiom-shortcodes-script', axiom_get_file_url('shortcodes/shortcodes.js'), array('jquery'), null, true ); if (is_single() && axiom_get_custom_option('show_reviews') == 'yes') { axiom_enqueue_script('axiom-core-reviews-script', axiom_get_file_url('js/core.reviews.js'), array('jquery'), null, true); } axiom_enqueue_script('axiom-core-utils-script', axiom_get_file_url('js/core.utils.js'), array('jquery'), null, true); axiom_enqueue_script('axiom-core-init-script', axiom_get_file_url('js/core.init.js'), array('jquery'), null, true); } // Media elements library if (axiom_get_theme_option('use_mediaelement') == 'yes') { wp_enqueue_style('mediaelement'); wp_enqueue_style('wp-mediaelement'); wp_enqueue_script('mediaelement'); wp_enqueue_script('wp-mediaelement'); } else { global $wp_scripts; $wp_scripts->done[] = 'mediaelement'; $wp_scripts->done[] = 'wp-mediaelement'; $wp_styles->done[] = 'mediaelement'; $wp_styles->done[] = 'wp-mediaelement'; } // Video background if (axiom_get_custom_option('show_video_bg') == 'yes' && axiom_get_custom_option('video_bg_youtube_code') != '') { axiom_enqueue_script('axiom-video-bg-script', axiom_get_file_url('js/jquery.tubular.1.0.js'), array('jquery'), null, true); } // Google map if (axiom_get_custom_option('show_googlemap') == 'yes') { axiom_enqueue_script('googlemap', 'http://maps.google.com/maps/api/js?sensor=false', array(), null, true); axiom_enqueue_script('axiom-googlemap-script', axiom_get_file_url('js/core.googlemap.js'), array(), null, true); } // Social share buttons if (is_singular() && !axiom_get_global('blog_streampage') && axiom_get_custom_option('show_share') != 'hide') { axiom_enqueue_script('axiom-social-share-script', axiom_get_file_url('js/social/social-share.js'), array('jquery'), null, true); } // Comments if (is_singular() && !axiom_get_global('blog_streampage') && comments_open() && get_option('thread_comments')) { axiom_enqueue_script('comment-reply', false, array(), null, true); } // Custom panel if (axiom_get_custom_option('show_theme_customizer') == 'yes') { if (file_exists(axiom_get_file_dir('core/core.customizer/front.customizer.css'))) { axiom_enqueue_style('axiom-customizer-style', axiom_get_file_url('core/core.customizer/front.customizer.css'), array(), null); } if (file_exists(axiom_get_file_dir('core/core.customizer/front.customizer.js'))) { axiom_enqueue_script('axiom-customizer-script', axiom_get_file_url('core/core.customizer/front.customizer.js'), array(), null, true); } } //Debug utils if (axiom_get_theme_option('debug_mode') == 'yes') { axiom_enqueue_script('axiom-core-debug-script', axiom_get_file_url('js/core.debug.js'), array(), null, true); } // Theme skin script do_action('axiom_action_add_scripts'); }
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; }
function axiom_post_get_blog_type($page, $query = null) { if (!empty($page)) { return $page; } if (isset($query->queried_object) && isset($query->queried_object->post_type) && $query->queried_object->post_type == 'page') { $page = get_post_meta($query->queried_object_id, '_wp_page_template', true); if (axiom_substr($page, 0, 7) == 'default') { $page = ''; } } else { if (isset($query->query_vars['page_id'])) { $page = get_post_meta($query->query_vars['page_id'], '_wp_page_template', true); } else { if (isset($query->queried_object) && isset($query->queried_object->taxonomy)) { $page = $query->queried_object->taxonomy; } } } if (!empty($page)) { $page = str_replace('.php', '', $page); } else { if ($query && $query->is_404()) { // || is_404() ) // -------------- 404 error page $page = 'error404'; } else { if ($query && $query->is_search()) { // || is_search() ) // -------------- Search results $page = 'search'; } else { if ($query && $query->is_day()) { // || is_day() ) // -------------- Archives daily $page = 'archives_day'; } else { if ($query && $query->is_month()) { // || is_month() ) // -------------- Archives monthly $page = 'archives_month'; } else { if ($query && $query->is_year()) { // || is_year() ) // -------------- Archives year $page = 'archives_year'; } else { if ($query && $query->is_category()) { // || is_category() ) // -------------- Category $page = 'category'; } else { if ($query && $query->is_tag()) { // || is_tag() ) // -------------- Tag posts $page = 'tag'; } else { if ($query && $query->is_author()) { // || is_author() ) // -------------- Author page $page = 'author'; } else { if ($query && $query->is_attachment()) { // || is_attachment() ) $page = 'attachment'; } else { if ($query && $query->is_single()) { // || is_single() ) // -------------- Single post $page = 'single'; } else { if ($query && $query->is_page()) { // || is_page() ) $page = 'page'; } else { // -------------- Home page $page = 'home'; } } } } } } } } } } } } return $page; }
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; }
function axiom_attachment_save_compat($post = null, $attachment_data = null) { if (!empty($post['ID']) && ($id = intval($post['ID'])) > 0) { $folders = array(); $from_media_library = !empty($_REQUEST['tax_input']['media_folder']) && is_array($_REQUEST['tax_input']['media_folder']); // From AJAX query if (!$from_media_library) { foreach ($_REQUEST as $k => $v) { if (axiom_substr($k, 0, 12) == 'media_folder') { $folders[] = $v; } } } else { if (count($folders) == 0) { if (!empty($_REQUEST['tax_input']['media_folder']) && is_array($_REQUEST['tax_input']['media_folder'])) { foreach ($_REQUEST['tax_input']['media_folder'] as $k => $v) { if ((int) $v > 0) { $folders[] = $v; } } } } } if (count($folders) > 0) { foreach ($folders as $k => $v) { if ((int) $v > 0) { $term = get_term_by('id', $v, 'media_folder'); $folders[$k] = $term->slug; } } } else { $folders = null; } // Save folders list only from AJAX if (!$from_media_library) { wp_set_object_terms($id, $folders, 'media_folder', false); } } return $post; }
<?php /* Template Name: Blog streampage */ global $AXIOM_GLOBALS; $AXIOM_GLOBALS['blog_streampage'] = true; get_header(); global $wp_query, $post; $blog_style = axiom_get_custom_option('blog_style'); $blog_columns = max(1, (int) axiom_substr($blog_style, -1)); $show_sidebar = axiom_get_custom_option('show_sidebar_main'); $show_filters = axiom_get_custom_option('show_filters'); $ppp = (int) axiom_get_custom_option('posts_per_page'); $hover = axiom_get_custom_option('hover_style'); if (empty($hover)) { $hover = 'square effect_shift'; } $hover_dir = axiom_get_custom_option('hover_dir'); if (empty($hover_dir)) { $hover_dir = 'left_to_right'; } $page_number = get_query_var('paged') ? get_query_var('paged') : (get_query_var('page') ? get_query_var('page') : 1); $wp_query_need_restore = false; $args = $wp_query->query_vars; $args['post_status'] = current_user_can('read_private_pages') && current_user_can('read_private_posts') ? array('publish', 'private') : 'publish'; if (is_page() || !empty($AXIOM_GLOBALS['blog_filters'])) { unset($args['p']); unset($args['page_id']); unset($args['pagename']); unset($args['name']);
function axiom_template_accordion_add_scripts($style) { if (axiom_substr($style, 0, 10) == 'accordion_') { axiom_enqueue_script('jquery-ui-accordion', false, array('jquery', 'jquery-ui-core'), null, true); } }
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 }
function axiom_hex2rgb($hex) { $dec = hexdec(axiom_substr($hex, 0, 1) == '#' ? axiom_substr($hex, 1) : $hex); return array('r' => $dec >> 16, 'g' => ($dec & 0xff00) >> 8, 'b' => $dec & 0xff); }
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; }
<?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>$</b> <?php _e('Dollar', 'axiom'); ?> </a></li> <li><a href="#"><b>€</b> <?php
function axiom_get_twitter_data($cfg) { $data = get_transient("twitter_data_" . $cfg['mode']); if (!$data) { require_once axiom_get_file_dir('lib/tmhOAuth/tmhOAuth.php'); $tmhOAuth = new tmhOAuth(array('consumer_key' => $cfg['consumer_key'], 'consumer_secret' => $cfg['consumer_secret'], 'token' => $cfg['token'], 'secret' => $cfg['secret'])); $code = $tmhOAuth->user_request(array('url' => $tmhOAuth->url(axiom_get_twitter_mode_url($cfg['mode'])))); if ($code == 200) { $data = json_decode($tmhOAuth->response['response'], true); if (isset($data['status'])) { $code = $tmhOAuth->user_request(array('url' => $tmhOAuth->url(axiom_get_twitter_mode_url($cfg['oembed'])), 'params' => array('id' => $data['status']['id_str']))); if ($code == 200) { $data = json_decode($tmhOAuth->response['response'], true); } } set_transient("twitter_data_" . $cfg['mode'], $data, 60 * 60); } } else { if (!is_array($data) && axiom_substr($data, 0, 2) == 'a:') { $data = unserialize($data); } } return $data; }
function axiom_template_masonry_add_scripts($style) { if (in_array(axiom_substr($style, 0, 8), array('classic_', 'masonry_'))) { axiom_enqueue_script('isotope', axiom_get_file_url('js/jquery.isotope.min.js'), array(), null, true); } }