public function run() { $loader = Autoloader::instance(); pc($loader, 'loader'); $ViewClass = $loader->view(); $view = new $ViewClass(); $view->render(); }
public function save() { pc($this->object->raw, 'acf'); if (!$this->object->raw) { return; } foreach ($this->updated as $key => $value) { update_field($key, $value, $this->object->raw); } }
function template_render() { //$app = new \Yare\App(); //$app->run(); $loader = \Yare\Autoloader::instance(); pc($loader, 'loader'); $ViewClass = $loader->view(); $view = new $ViewClass(); $view->render(); }
public function __construct() { if ($uri = get_query_var('yare_uri')) { $args = get_query_var('yare_args'); pc($args, 'yare_args'); $pattern = array_get($args, 'pattern'); $route = array_get($args, 'route'); if (preg_match("#^{$pattern}#i", $uri, $params)) { array_shift($params); } $request = Request::get_instance(); $request->setRoutes($params); $map = array(); foreach ($params as $key => $value) { if (is_string($key)) { $map["{{$key}}"] = $this->camel_case($value); } } $search = array_keys($map); $replace = array_values($map); $this->model = str_replace($search, $replace, array_get($args, 'model')); $this->mapKeys = array($uri, $route, $this->model); } else { foreach ($this->conditional as $conditional) { if (!function_exists($conditional)) { continue; } if (call_user_func($conditional) and method_exists($this, $conditional)) { if ($this->model = $this->{$conditional}()) { break; } } } } if (!$this->model) { $this->model = 'Index'; array_push($this->mapKeys, 'Index'); } }
protected function get_posts() { $defaults = array('numberposts' => 5, 'category' => 0, 'orderby' => 'date', 'order' => 'DESC', 'include' => array(), 'exclude' => array(), 'meta_key' => '', 'meta_value' => '', 'post_type' => 'any', 'suppress_filters' => true); $r = wp_parse_args($this->args, $defaults); if (empty($r['post_status'])) { $r['post_status'] = 'attachment' == $r['post_type'] ? 'inherit' : 'publish'; } if (!empty($r['numberposts']) && empty($r['posts_per_page'])) { $r['posts_per_page'] = $r['numberposts']; } if (!empty($r['category'])) { $r['cat'] = $r['category']; } if (!empty($r['include'])) { $incposts = wp_parse_id_list($r['include']); $r['posts_per_page'] = count($incposts); // only the number of posts included $r['post__in'] = $incposts; } elseif (!empty($r['exclude'])) { $r['post__not_in'] = wp_parse_id_list($r['exclude']); } $r['ignore_sticky_posts'] = true; $r['no_found_rows'] = true; pc($r); $get_posts = new WP_Query(); return array_map(array($this, 'return_object'), $get_posts->query($r)); }
function wpsw_insert_form($src, $title = 'Untitled') { if (file_exists($file = wpsw_get_path(wpsw_get_config('templates.views', 'web/views') . $src))) { $_POST['wpcf7-form'] = apply_filters('wpsw_cf7form', file_get_contents($file)); } else { return false; } $_POST['post_title'] = $title; if (!function_exists('wpcf7_save_contact_form')) { require_once WPCF7_PLUGIN_DIR . '/admin/includes/admin-functions.php'; } $id = wpsw_get_alias_id($src); $id = wpcf7_save_contact_form($id); pc($id, 'id'); add_post_meta($id, '_wpsw_alias', $src, true); return $id; }
protected function create_nav_menu() { if (!function_exists('wp_create_nav_menu')) { require_once ABSPATH . 'wp-admin/includes/nav-menu.php'; } $nav_menu_locations = array(); foreach (wpsw_get_config('register.nav_menus') as $menu_key => $menu_name) { wp_delete_nav_menu($menu_name); $items = array_get($this->menus, $menu_key, array()); $menu_items = array(); foreach ($items as $key => $item) { $data = array(); $data['menu-item-title'] = $item['title']; $data['menu-item-position'] = $key + 1; if (isset($item['class'])) { $data['menu-item-classes'] = explode(' ', $item['class']); } if (isset($item['link'])) { $src = preg_replace('/\\.html$/i', '.md', $item['link']); $id = wpsw_get_alias_id($src); $post = get_post($id); if ($post) { $data['menu-item-type'] = 'post_type'; $data['menu-item-object'] = $post->post_type; $data['menu-item-object-id'] = $id; } else { $data['menu-item-url'] = $item['link']; } } $menu_item = $this->perpare_nav_item_data($data); $menu_item_db_id = $this->add_nav_menu_item($menu_name, $menu_item); pc($menu_item_db_id, 'menu_item_db_id'); foreach (array_get($item, 'sub_menu', array()) as $index => $sub_item) { $data = array(); $data['menu-item-title'] = $sub_item['title']; $data['menu-item-position'] = $index + 1; $data['menu-item-parent-id'] = $menu_item_db_id; if (isset($sub_item['class'])) { $data['menu-item-classes'] = explode(' ', $sub_item['class']); } if (isset($sub_item['link'])) { $src = preg_replace('/\\.html$/i', '.md', $sub_item['link']); $id = wpsw_get_alias_id($src); $post = get_post($id); if ($post) { $data['menu-item-type'] = 'post_type'; $data['menu-item-object'] = $post->post_type; $data['menu-item-object-id'] = $id; } else { $data['menu-item-url'] = $sub_item['link']; } } $sub_menu_item = $this->perpare_nav_item_data($data); $sub_menu_item_db_id = $this->add_nav_menu_item($menu_name, $sub_menu_item); } } // items loop $menu = wp_get_nav_menu_object($menu_name); $nav_menu_locations[$menu_key] = $menu->term_id; } // register.nav_menus loop $theme_mods = array(false, 'nav_menu_locations' => $nav_menu_locations); $theme = get_option('stylesheet'); if (get_option("theme_mods_{$theme}")) { update_option("theme_mods_{$theme}", $theme_mods); } else { add_option("theme_mods_{$theme}", $theme_mods); } }
<?php include "ui.php"; $ui = new UI(); ?> <ul> <li data-row="1" data-col="1" data-sizex="1" data-sizey="4"> <header>RÄUME</header> <?php include "widget/widget.rooms.php"; ?> </li> <?php pc('WATER'); ?> <li data-row="4" data-col="2" data-sizex="2" data-sizey="1"> <header>SWITCHES</header> <div class="centered container"> <div class="right"> <div data-type="switch" data-device="W_SWITCH_D1_Monitore" class="cell" data-icon="fa-desktop"></div> <div data-type="label" class="cell">Monitore</div> </div> <div class="right"> <div data-type="switch" data-device="W_SWITCH_B1_Boxen" class="cell" data-icon="fa-volume-up"></div> <div data-type="label" class="cell">Boxen</div> </div> </div> </li>
<?php include "ui.php"; $ui = new UI(); ?> <ul> <li data-row="1" data-col="1" data-sizex="1" data-sizey="4"> <header>RÄUME</header> <?php include "widget/widget.rooms.php"; ?> </li> <?php pc('REVO'); ?> <li data-row="4" data-col="2" data-sizex="2" data-sizey="1"> </li> <li data-row="4" data-col="6" data-sizex="2" data-sizey="1"> <header>WEITER</header> <?php include "widget/widget.schlafzimmer-more.php"; ?> </li> </ul>
function cimo($sc, $arena) { $cimo = $rival = 0; // vynuluj body for ($y = 0; $y < SIZE; $y++) { for ($x = 0; $x < SIZE; $x++) { $points[$x][$y] = 0; } } // urči symbol pro soupeře $sc == SX ? $sr = SO : ($sr = SX); // hodnoccení políček // horizontílní směr z leva do prava for ($y = 0; $y < SIZE; $y++) { for ($x = $cimo = $rival = 0; $x < SIZE; $x++) { $pc_out = pc($x, $y, $arena, $points, $sc, $sr, $cimo, $rival); $points = $pc_out['points']; $rival = $pc_out['rival']; $cimo = $pc_out['cimo']; } } // horizontální směr z prava do leva for ($y = 0; $y < SIZE; $y++) { for ($x = SIZE - 1, $cimo = $rival = 0; $x >= 0; $x--) { $pc_out = pc($x, $y, $arena, $points, $sc, $sr, $cimo, $rival); $points = $pc_out['points']; $rival = $pc_out['rival']; $cimo = $pc_out['cimo']; } } // vertikální směr z hora dolů for ($x = 0; $x < SIZE; $x++) { for ($y = $cimo = $rival = 0; $y < SIZE; $y++) { $pc_out = pc($x, $y, $arena, $points, $sc, $sr, $cimo, $rival); $points = $pc_out['points']; $rival = $pc_out['rival']; $cimo = $pc_out['cimo']; } } // vertikální směr z dola nahoru for ($x = 0; $x < SIZE; $x++) { for ($y = SIZE - 1, $cimo = $rival = 0; $y >= 0; $y--) { $pc_out = pc($x, $y, $arena, $points, $sc, $sr, $cimo, $rival); $points = $pc_out['points']; $rival = $pc_out['rival']; $cimo = $pc_out['cimo']; } } // z leva do prava směrem dolů // 1. trojúhelník for ($Y = 0; $Y < SIZE; $Y++) { for ($y = $Y, $x = $cimo = $rival = 0; $y < SIZE; $x++, $y++) { $pc_out = pc($x, $y, $arena, $points, $sc, $sr, $cimo, $rival); $points = $pc_out['points']; $rival = $pc_out['rival']; $cimo = $pc_out['cimo']; } } // 2. trojúhelník for ($X = 1; $X < SIZE; $X++) { for ($x = $X, $y = $cimo = $rival = 0; $x < SIZE; $x++, $y++) { $pc_out = pc($x, $y, $arena, $points, $sc, $sr, $cimo, $rival); $points = $pc_out['points']; $rival = $pc_out['rival']; $cimo = $pc_out['cimo']; } } // zleva do prava směrem nahoru // 1. trojúhelník for ($X = SIZE - 1; $X >= 0; $X--) { for ($x = $X, $y = SIZE - 1, $cimo = $rival = 0; $y >= 0; $x--, $y--) { $pc_out = pc($x, $y, $arena, $points, $sc, $sr, $cimo, $rival); $points = $pc_out['points']; $rival = $pc_out['rival']; $cimo = $pc_out['cimo']; } } // 2. troujúhelník for ($Y = SIZE - 1; $Y >= 0; $Y--) { for ($y = $Y, $x = SIZE - 1, $cimo = $rival = 0; $y >= 0; $x--, $y--) { $pc_out = pc($x, $y, $arena, $points, $sc, $sr, $cimo, $rival); $points = $pc_out['points']; $rival = $pc_out['rival']; $cimo = $pc_out['cimo']; } } // z prava do leva směrem dolů // 1. trojúhelník for ($X = SIZE - 1; $X >= 0; $X--) { for ($x = $X, $y = $cimo = $rival = 0; $x >= 0; $x--, $y++) { $pc_out = pc($x, $y, $arena, $points, $sc, $sr, $cimo, $rival); $points = $pc_out['points']; $rival = $pc_out['rival']; $cimo = $pc_out['cimo']; } } // 2. trojúhelník for ($Y = 1; $Y < SIZE; $Y++) { for ($y = $Y, $x = SIZE - 1, $cimo = $rival = 0; $y < SIZE; $x--, $y++) { $pc_out = pc($x, $y, $arena, $points, $sc, $sr, $cimo, $rival); $points = $pc_out['points']; $rival = $pc_out['rival']; $cimo = $pc_out['cimo']; } } // zprava do leva smrem nahoru // 1. troujúhelník for ($Y = SIZE - 1; $Y >= 0; $Y--) { for ($y = $Y, $x = $cimo = $rival = 0; $y >= 0; $x++, $y--) { $pc_out = pc($x, $y, $arena, $points, $sc, $sr, $cimo, $rival); $points = $pc_out['points']; $rival = $pc_out['rival']; $cimo = $pc_out['cimo']; } } // 2. troujúhelník for ($X = 0; $X < SIZE; $X++) { for ($x = $X, $y = SIZE - 1, $cimo = $rival = 0; $x < SIZE; $x++, $y--) { $pc_out = pc($x, $y, $arena, $points, $sc, $sr, $cimo, $rival); $points = $pc_out['points']; $rival = $pc_out['rival']; $cimo = $pc_out['cimo']; } } //body($points); // najdi políčko s nejlepším hodnocením for ($y = $X = $Y = $MAX = 0; $y < SIZE; $y++) { for ($x = 0; $x < SIZE; $x++) { if ($points[$x][$y] > $MAX) { $MAX = $points[$x][$y]; $X = $x; $Y = $y; } } } $out['x'] = $X; $out['y'] = $Y; return $out; }
public function register_menu_pages() { $admin_menu = Yare::config('register.admin_menus', array()); foreach ((array) $admin_menu as $menu_slug => $menu_args) { //if (isset($menu_args['link'])) { // continue; //} if (isset($menu_args['parent_slug'])) { $args = array('parent_slug' => 'options-general.php', 'page_title' => '', 'menu_title' => '', 'capability' => 'manage_options', 'menu_slug' => '', 'function' => ''); if (isset($menu_args['view'])) { $sub_view = array_get($menu_args, 'view', 'Admin'); $function = str_replace('\\', '_', $sub_view); //$parent_slug = array_get($menu_args, 'parent_slug', ''); $menu_args['menu_slug'] = $menu_slug; $menu_args['function'] = array($this, $function); } if (isset($menu_args['link'])) { $this->highlight_files[$menu_args['link']] = $menu_args['parent_slug']; $menu_args['menu_slug'] = $menu_args['link']; } foreach ($args as $key => $value) { $args[$key] = array_get($menu_args, $key, $value); } pc($args, 'add_submenu_page'); call_user_func_array('add_submenu_page', $args); continue; } $args = array('page_title' => '', 'menu_title' => '', 'capability' => 'manage_options', 'menu_slug' => '', 'function' => '', 'icon_url' => '', 'position' => 6); if (isset($menu_args['view'])) { $view = array_get($menu_args, 'view', 'Admin'); $function = str_replace('\\', '_', $view); $menu_args['menu_slug'] = $menu_slug; $menu_args['function'] = array($this, $function); } if (isset($menu_args['link'])) { //$this->highlight_files[$menu_args['link']] = $menu_args['parent_slug']; $menu_args['menu_slug'] = $menu_args['link']; } foreach ($args as $key => $value) { $args[$key] = array_get($menu_args, $key, $value); } pc($args, 'add_menu_page'); call_user_func_array('add_menu_page', $args); if ($sub_menu = array_get($menu_args, 'sub_menu')) { foreach ($sub_menu as $sub_menu_slug => $sub_menu_args) { //if (isset($sub_menu_args['link'])) { // continue; //} $args = array('parent_slug' => $menu_slug, 'page_title' => '', 'menu_title' => '', 'capability' => 'manage_options', 'menu_slug' => '', 'function' => ''); if (isset($sub_menu_args['view'])) { $sub_view = array_get($sub_menu_args, 'view', 'Admin'); $function = str_replace('\\', '_', $sub_view); $sub_menu_args['menu_slug'] = $menu_slug . '-' . $sub_menu_slug; $sub_menu_args['function'] = array($this, $function); } if (isset($sub_menu_args['link'])) { remove_menu_page($sub_menu_args['link']); $this->highlight_files[$sub_menu_args['link']] = $menu_slug; $sub_menu_args['menu_slug'] = $sub_menu_args['link']; } foreach ($args as $key => $value) { $args[$key] = array_get($sub_menu_args, $key, $value); } pc($args, 'add_submenu_page'); call_user_func_array('add_submenu_page', $args); } } } }
public static function register_fields(callable $callback) { $group = new Group(); $callback($group); $group->register(); pc($group->settings(), 'group'); }
<?php include "ui.php"; $ui = new UI(); ?> <ul> <li data-row="1" data-col="1" data-sizex="1" data-sizey="4"> <header>RÄUME</header> <?php include "widget/widget.rooms.php"; ?> </li> <?php pc('MIST'); ?> <li data-row="4" data-col="2" data-sizex="2" data-sizey="1"> </li> <li data-row="4" data-col="6" data-sizex="2" data-sizey="1"> <header>WEITER</header> <div class="centered container"> <div class="left"> <?php include "widget/widget.buero-more.php"; ?> </div> <div class="left"> <?php button('xbmc', 'buero-xbmc-simple.php', 'nesges-kodi');
public function render() { $this->response->view(); //$this->response->json(); pc($this, 'current.view'); }