function theme_config($args = array()) { static $page_type; if (!isset($page_type)) { $page_type = $this->get(array('theme', 'type')); } if ($this->_check_args($args)) { $found = false; $config = array(); if (is_array($args[0])) { $key = array_shift($args[0]); if (count($args[0]) == 0) { array_shift($args); } } else { $key = array_shift($args); } if (!isset($this->_configs[$key])) { $path = OP_PAGES . $page_type . '/' . $key; $theme_url = OP_URL . 'pages/' . $page_type . '/' . $key . '/'; if (file_exists($path . '/config.php')) { op_textdomain(OP_SN . '_p_' . $key, $path . '/'); require_once $path . '/config.php'; $this->_configs[$key] = $config; return _op_traverse_array($this->_configs[$key], $args); } } else { return _op_traverse_array($this->_configs[$key], $args); } } return false; }
function open_sales_cart() { $return = false; if (_op_traverse_array($this->funnel_pages, array('sales', 'page_setup', 'open_sales_cart')) == 'Y') { $return = true; } return $return; }
function op_help_url($sections, $html, $return) { static $video_counter = 0; $vid = ''; $func = 'op_theme_config'; if (defined('OP_PAGEBUILDER')) { $func = 'op_page_config'; } if (!($video = $func('help_videos', $sections))) { if (!($video = _op_traverse_array(op_default_help_vids(), $sections))) { return ''; } } $width = '511'; $height = '288'; $url = $video; if (is_array($video)) { $width = op_get_var($video, 'width', $width); $height = op_get_var($video, 'height', $height); $url = op_get_var($video, 'url', $url); } $out = ''; if (!empty($url)) { $video_counter++; $arr = array('playlist' => array(array('autoPlay' => true, 'autoBuffering' => true, 'url' => $url)), 'plugins' => array('controls' => array('url' => OP_MOD_URL . 'blog/video/flowplayer/flowplayer.controls-3.2.5.swf'))); $url = OP_MOD_URL . 'blog/video/flowplayer/flowplayer-3.2.7.swf?config=' . str_replace('"', "'", json_encode($arr)); $vid = ' <div> <input type="hidden" name="help_vid_width[]" value="' . $width . '" class="help_vid_width" /> <input type="hidden" name="help_vid_height[]" value="' . $height . '" class="help_vid_height" /> </div> '; $out = str_replace(array('{url}', '{vid}'), array($url, $vid), $html); } if ($return) { return $out; } echo $out; }
function _op_traverse_array($array, $args) { if (count($args) == 0) { return $array; } else { $found = true; for ($i = 0, $al = count($args); $i < $al; $i++) { /// fixing notice if $args[$i] is not set, I don't know what I am doing (Zvonko) // this was manifested in Dashboard if (!isset($args[$i])) { continue; } if (is_array($args[$i])) { if (!($array = _op_traverse_array($array, $args[$i]))) { $found = false; break; } } else { if (isset($array[$args[$i]])) { $array = $array[$args[$i]]; } else { $found = false; break; } } } return $found ? $array : false; } }
function theme_config($args = array()) { if (count($args) == 0) { return false; } $found = false; $config = array(); if (is_array($args[0])) { $key = array_shift($args[0]); if (count($args[0]) == 0) { array_shift($args); } } else { $key = array_shift($args); } if (!isset($this->_configs[$key])) { $path = OP_THEMES . $key; $theme_url = OP_URL . 'themes/' . $key . '/'; if (file_exists($path . '/config.php')) { op_textdomain(OP_SN . '_' . $key, $path . '/'); require_once $path . '/config.php'; $this->_configs[$key] = $config; return _op_traverse_array($this->_configs[$key], $args); } } else { return _op_traverse_array($this->_configs[$key], $args); } return false; }
function _op_launch_menu_item($page_type, $arr, $active = true, $selected = false) { $pref = !$active ? 'in' : ''; $objs = array('page_setup', 'navigation', 'page_thumbnails'); foreach ($objs as $o) { ${$o} = _op_traverse_array($arr, array($o)); } $page_id = op_get_var($page_setup, $page_type, 0); $menu = array('active' => $active, 'text' => op_get_var($navigation, $pref . 'active_link_text'), 'image' => op_get_var($page_thumbnails, $pref . 'active_thumbnail'), 'selected' => $selected, 'page_id' => $page_id); if ($active) { $menu['link'] = get_permalink($page_id); } return $menu; }
function _op_traverse_array($array, $args) { if (count($args) == 0) { return $array; } else { $found = true; for ($i = 0, $al = count($args); $i < $al; $i++) { if (is_array($args[$i])) { if (!($array = _op_traverse_array($array, $args[$i]))) { $found = false; break; } } else { if (isset($array[$args[$i]])) { $array = $array[$args[$i]]; } else { $found = false; break; } } } return $found ? $array : false; } }