function add() { $this->load->library('m_security'); $this->m_security->filterPost('addname', 'required'); if ($this->m_security->startPost() == TRUE) { $name = $this->input->post('addname', TRUE); $slug = ""; $slugX = $this->input->post('addslug', TRUE); if (!empty($slugX)) { $slug = $slugX; } else { $slug = stringCreateSlug($name); } $parent = $this->input->post('addparent', TRUE); $desc = $this->input->post('adddescription', TRUE); $proses = insertTerms("category", $name, $slug, $desc, $parent); if ($proses == TRUE) { echo json_encode("ok"); } else { echo json_encode("no"); } } else { echo json_encode("no"); } }
function widgetAdd($name, $description = '') { $CI =& get_instance(); $CI->load->helper('posts_helper'); $ssName = $name . "_widget"; $nameWidget = $name . "-widget"; $slugname = stringCreateSlug($name); $jsonData = json_encode(array('service' => strtolower($name), 'description' => $description)); insertTerms($ssName, $slugname, $slugname); }
function addwidget() { //insertTerms(); $termid = $this->input->post('id'); $pos = $this->input->post('pos'); $widget = $this->input->post('widget'); $s = array('term_id' => $termid); $name = $this->m_database->fieldRow('terms', $s, 'name'); $slug = $this->m_database->fieldRow('terms', $s, 'slug'); $data = json_encode(array('prefix' => $widget)); $time = strtotime(dateNow(TRUE)); insertTerms("sidebar", $name . "_item", $slug . "-item-" . $time, "", $termid, $data); echo json_encode('ok'); }
function addPage() { $kat = $this->input->post('page'); $menu = $this->input->post('menu'); if (!empty($kat) && !empty($menu)) { $output = ''; foreach ($kat as $k => $v) { $json = json_encode(array('create' => dateNow(TRUE), 'relasi' => 'page', 'pageid' => $v, 'theme' => getThemeActive())); $postTitle = postInfo($v, "post_title"); $postSlug = postInfo($v, "post_slug"); insertTerms("menu_" . $menu . "_" . getThemeActive(), $postTitle, $postSlug . "-" . getThemeActive() . "-menu", "", "", $json); $output .= $postSlug; } echo json_encode('ok'); //echo json_encode($output); } else { echo json_encode('no'); } }
function mc_register_menu($theme, $position) { $data = json_encode(array('theme' => $theme, 'rel' => 'menu')); insertTerms('menu_theme', $theme . '_theme_menu_' . $position, $theme . '-theme-menu-' . $position, '', $data); }
function blocking() { $ip = $this->input->ip_address(); $this->load->helper('posts_helper'); insertTerms("blockip", "block_ip_" . $ip, "block-ip-" . $ip, "", "-"); }
<?php $path = scandir(MODPATH . 'service/controllers/widget'); $dpath = array_diff($path, array('.', '..')); $prefix = ".php"; foreach ($dpath as $key => $val) { $val = strtolower(str_replace($prefix, "", $val)); $label = strtoupper(str_replace($prefix, "", $val)); if (!is_dir(MODPATH . 'service/controllers/widget/' . $val)) { $json = json_encode(array('service' => $val, 'description' => 'Menampilkan ' . $val)); insertTerms($val . "_widget", $val . "-widget", $val . "-widget", 'Menampilkan ' . $val, "0", $json); ?> <div class="col-md-4 col-sm-6"> <div class="panel panel-default"> <div class="panel-heading"><?php echo $label; ?> </div> <div class="panel-body"> <?php $d = getTerms($val . "_widget"); foreach ($d as $r) { } $termid = $r->term_id; $data = menuInfoJSON($termid, "description"); echo $data; ?> </div> <div class="panel-footer"> <a href="javascript:;" onclick="addwidget('<?php
function insertTags($name, $slug, $description = '', $parent = '0', $termdata = '') { return insertTerms("tag", $name, $slug, $description, '0', $termdata); }