public function index() { set_core_vars('options', $options = get_meta('all'), 'read_only'); if (riake('tendoo_registration_status', $options) == '0') { $this->instance->url->redirect(array('error', 'code', 'registration-not-allowed')); } $this->instance->form_validation->set_rules('user_pseudo', translate('Pseudo'), 'trim|required|min_length[5]|max_length[15]'); $this->instance->form_validation->set_rules('user_password', __('Password'), 'trim|required|min_length[6]|max_length[15]'); $this->instance->form_validation->set_rules('user_password_confirm', __('Confirm Password'), 'trim|required|min_length[6]|max_length[15]'); $this->instance->form_validation->set_rules('user_mail', __('Email'), 'trim|valid_email|required'); $this->instance->form_validation->set_rules('user_sex', __('Sex'), 'trim|required|min_length[3]|max_length[4]'); $this->instance->form_validation->set_rules('priv_id', __('Select Privilege'), 'trim|min_length[11]'); $this->instance->form_validation->set_rules('captchaCorrespondance', __('Captcha Code'), 'trim|required|min_length[6]'); $this->instance->form_validation->set_rules('user_captcha', __('Captcha validation Code'), 'matches[captchaCorrespondance]|trim|required|min_length[6]'); if ($this->instance->form_validation->run()) { $query = $this->instance->users_global->createUser($this->instance->input->post('user_pseudo'), $this->instance->input->post('user_password'), $this->instance->input->post('user_sex'), $this->instance->input->post('user_mail'), $active = 'FALSE', $this->instance->input->post('priv_id')); if ($query == 'userCreated') { $this->instance->url->redirect(array('login?notice=' . $query)); } notice('push', fetch_notice_output($query)); } set_core_vars('allowPrivilege', $this->roles->get_public_roles()); $this->instance->session->set_userdata('captcha_code', $this->instance->captcha->get()); set_core_vars('captcha', $this->instance->session->userdata('captcha_code')); set_core_vars('pageTitle', sprintf(__('Create an account - %s '), riake('site_name', $options))); set_page('title', get_core_vars('pageTitle')); set_core_vars('body', $this->load->the_view('registration/createUser', true)); $this->load->view('header'); $this->load->view('global_body'); }
function loader() { global $Options; // If cache is enabled if (riake('enable_cache', $Options) === true) { $this->db->cache_on(); } }
private function output_files() { theme_cpush("css/font-awesome.min"); theme_cpush("css/bootstrap.min"); theme_cpush("css/switcher"); theme_cpush("css/fractionslider"); theme_cpush("css/style-fraction"); theme_cpush("css/style"); $theme_style = get_items('theme_color_and_style'); if (($background = riake('background', $theme_style)) == 'red') { theme_cpush("css/skins/Softred"); } else { if ($background == 'orange') { theme_cpush("css/skins/orange"); } else { if ($background == 'purple') { theme_cpush("css/skins/purple"); } else { if ($background == 'cyan') { theme_cpush("css/skins/Strongcyan"); } else { if ($background == 'darkcyan') { theme_cpush("css/skins/DarkCyan"); } else { if ($background == 'blue') { theme_cpush("css/skins/blue"); } } } } } } // Box Style if ($box = riake('box_style', $theme_style) == 'boxed') { theme_cpush("css/layout/boxed"); } else { theme_cpush("css/layout/wide"); } theme_jpush('js/jquery-1.10.2.min'); theme_jpush("js/bootstrap.min"); theme_jpush("js/jquery.easing.1.3"); theme_jpush("js/retina-1.1.0.min"); theme_jpush("js/jquery.cookie"); theme_jpush("js/styleswitch"); theme_jpush("js/jquery.fractionslider"); theme_jpush("js/jquery.smartmenus.min"); theme_jpush("js/jquery.smartmenus.bootstrap.min"); theme_jpush("js/jquery.jcarousel"); theme_jpush("js/jflickrfeed"); theme_jpush("js/jquery.magnific-popup.min"); theme_jpush("js/jquery.isotope.min"); theme_jpush("js/swipe"); theme_jpush("js/jquery-scrolltofixed-min"); theme_jpush("js/jquery.gmap"); theme_jpush("js/main"); }
function log_user_out() { if ($this->users->logout() == NULL) { if (($redir = riake('redirect', $_GET)) != false) { // if redirect parameter is set } else { redirect(array('sign-in')); } } // not trying to handle false since this controller require login. // While accessing this controller twice, a redirection will be made to login page from "tendoo_controller". }
/** * Push notice to UI array * * @access public * @params string message * @params string type * @returns bool **/ static function push_notice($message, $type = 'info', $icon = false, $href = '#') { if (is_array($message) && count($message) > 0) { foreach ($message as $_message) { self::push_notice($_message['msg'], riake('type', $_message), riake('icon', $_message), riake('href', $_message, $href)); } } else { if (is_string($message)) { self::$notices[] = array('type' => $type, 'msg' => $message, 'icon' => $icon, 'href' => $href); } } }
function run() { $this->events->add_filter('admin_menus', function ($menus) { if (User::can($this->privilege)) { $menus[$this->namespace] = array(array('title' => $this->label, 'href' => '#', 'disable' => true, 'icon' => $this->menu_icon), array('title' => $this->posts_list_label, 'href' => site_url(array('dashboard', 'posttype', $this->namespace, 'list'))), array('title' => $this->new_post_label, 'href' => site_url(array('dashboard', 'posttype', $this->namespace, 'new')))); if ($this->comment_enabled === TRUE) { $menus[$this->namespace][] = array('title' => $this->post_comment_label, 'href' => site_url(array('dashboard', 'posttype', $this->namespace, 'comments'))); } foreach (force_array($this->query->get_defined_taxonomies()) as $taxonomy) { $menus[$this->namespace][] = array('title' => riake('taxonomy-list-label', $taxonomy, sprintf(__('%s list'), riake('namespace', $taxonomy))), 'href' => site_url(array('dashboard', 'posttype', $this->namespace, 'taxonomy', riake('namespace', $taxonomy), 'list'))); $menus[$this->namespace][] = array('title' => riake('new-taxonomy-label', $taxonomy, sprintf(__('New %s'), riake('namespace', $taxonomy))), 'href' => site_url(array('dashboard', 'posttype', $this->namespace, 'taxonomy', riake('namespace', $taxonomy), 'new'))); } } return $menus; }); }
function run() { if (current_user()->can($this->privilege)) { create_admin_menu($this->namespace, riake(0, $this->menu_position), riake(1, $this->menu_position)); add_admin_menu($this->namespace, array('title' => $this->label, 'href' => '#', 'is_submenu' => false, 'icon' => $this->menu_icon)); add_admin_menu($this->namespace, array('title' => $this->posts_list_label, 'href' => get_instance()->url->site_url(array('admin', 'posttype', $this->namespace, 'list')))); add_admin_menu($this->namespace, array('title' => $this->new_post_label, 'href' => get_instance()->url->site_url(array('admin', 'posttype', $this->namespace, 'new')))); if ($this->comment_enabled === TRUE) { add_admin_menu($this->namespace, array('title' => $this->post_comment_label, 'href' => get_instance()->url->site_url(array('admin', 'posttype', $this->namespace, 'comments')))); } foreach (force_array($this->query->get_defined_taxonomies()) as $taxonomy) { add_admin_menu($this->namespace, array('title' => riake('taxonomy-list-label', $taxonomy, sprintf(__('%s list'), riake('namespace', $taxonomy))), 'href' => get_instance()->url->site_url(array('admin', 'posttype', $this->namespace, 'taxonomy', riake('namespace', $taxonomy), 'list')))); add_admin_menu($this->namespace, array('title' => riake('new-taxonomy-label', $taxonomy, sprintf(__('New %s'), riake('namespace', $taxonomy))), 'href' => get_instance()->url->site_url(array('admin', 'posttype', $this->namespace, 'taxonomy', riake('namespace', $taxonomy), 'new')))); } } }
function __construct() { // Saving Theme Settings $active_theme = get_core_vars('active_theme'); if (riake('namespace', $active_theme)) { $settings = get_meta($active_theme['namespace'] . '_theme_settings'); if ($settings) { push_core_vars('active_theme', 'theme_settings', $settings); } } $this->module = get_modules('filter_namespace', 'tim'); if (is_admin()) { $this->menu = new Menu(); $this->menu = new Menu(); $this->menu->add_admin_menu_core('themes', array('title' => __('Theme Options'), 'icon' => 'fa fa-columns', 'href' => get_instance()->url->site_url(array('admin', 'open', 'modules', $this->module['namespace'])))); } }
public function __construct($data) { $this->instance = get_instance(); $this->data =& $data; $this->theme = get_core_vars('active_theme_object'); $this->location = MODULES_DIR . $this->data['currentWidget']['WIDGET_MODULE']['encrypted_dir']; if (!class_exists('News_smart')) { include_once $this->location . '/library.php'; } $this->news = new News_smart(); $this->data['mostViewed'] = $this->news->getMostViewed(0, 10); $end = '<ul>'; if ($this->instance->users_global->isConnected()) { $this->instance->load->library('tendoo_admin'); if ($this->instance->users_global->isAdmin()) { $priv = $this->instance->users_global->current('REF_ROLE_ID'); if ($this->instance->users_global->isSuperAdmin()) { $end .= '<li><a href="' . $this->instance->url->site_url(array('admin', 'modules')) . '">Liste des modules</a></li>'; $end .= '<li><a href="' . $this->instance->url->site_url(array('admin', 'setting')) . '">Paramètres</a></li>'; $end .= '<li><a href="' . $this->instance->url->site_url(array('admin', 'system', 'manage_actions')) . '">Gestion d\'actions</a></li>'; $end .= '<li><a href="' . $this->instance->url->site_url(array('admin', 'installer')) . '">Installer une application</a></li>'; } else { if (!$this->instance->tendoo_admin->is_public_role($priv)) { $end .= '<li><a href="' . $this->instance->url->site_url(array('admin')) . '">Espace administration</a></li>'; } } } $end .= '<li><a href="' . $this->instance->url->site_url(array('account')) . '">Mon profil</a></li>'; $end .= '<li><a href="' . $this->instance->url->site_url(array('account', 'messaging', 'home')) . '">Ma messagerie</a></li>'; } else { $options = get_meta('all'); if (riake('allow_registration', $options) == '1') { $end .= '<li><a href="' . $this->instance->url->site_url(array('registration')) . '">Inscription</a></li>'; } $end .= '<li><a href="' . $this->instance->url->site_url(array('login')) . '">Connexion</a></li>'; } $end .= '</ul>'; // For Zones if (in_array($this->data['widgets']['requestedZone'], array('LEFT', 'BOTTOM', 'RIGHT'))) { $widget_title = $this->data['currentWidget']['WIDGET_INFO']['WIDGET_TITLE']; $zone = $this->data['widgets']['requestedZone']; // requestedZone set_widget(strtolower($zone), $widget_title, $end, 'text'); } }
/** * Sign In index page * * Displays login page * @return : void **/ public function index() { $this->events->do_action('set_login_rules'); // in order to let validation return true $this->form_validation->set_rules('submit_button', __('Submit button'), 'alpha_dash'); if ($this->form_validation->run()) { // Log User After Applying Filters $this->events->do_action('do_login'); $exec = $this->events->apply_filters('tendoo_login_notice', 'user-logged-in'); if ($exec == 'user-logged-in') { if (riake('redirect', $_GET)) { redirect(urldecode(riake('redirect', $_GET))); } else { redirect(array('dashboard')); } } $this->notice->push_notice($this->lang->line($exec)); } // load login fields $this->config->set_item('signin_fields', $this->events->apply_filters('signin_fields', $this->config->item('signin_fields'))); Html::set_title(sprintf(__('Sign In — %s'), get('core_signature'))); $this->load->view('shared/header'); $this->load->view('sign-in/body'); }
<div class="blog_medium"> <?php if (have_blog_posts() !== false) { while ($post = get_blog_posts()) { $full_date = $this->instance->date->time($post->timestamp, TRUE); $date = $this->instance->date->time($post->timestamp); // loop_categories($post->categories); ?> <article class="post"> <div class="post_date"> <span class="day"><?php echo riake('d', $full_date); ?> </span> <span class="month"><?php echo riake('m', $full_date); ?> </span> </div> <figure class="post_img"> <a href="<?php echo $post->link; ?> "> <img src="<?php echo $post->thumb; ?> " alt="blog post"> </a> </figure> <div class="post_content">
?> <?php get_instance()->load->view('admin/others/gui_dynamic_table_js'); ?> <?php } ?> </div> <?php /** * Details : Output content after cols * Usage : set 'after_cols' key with GUI::config() **/ ?> <?php echo riake('after_cols', $output, ''); ?> </section> <section class="content-footer" style=""> <div class="row m-t-sm text-center-xs"> <?php if (in_array('loader', $enabled)) { ?> <div class="col-sm-2 pull-left" id="ajaxLoading"> </div> <?php } else { ?> <div class="col-sm-2"> </div> <?php
} // if pagination is enabled if (riake('pagination', $footer)) { ?> <ul class="pagination pagination-sm no-margin pull-right"> <li><a href="#">«</a></li> <li><a href="#">1</a></li> <li><a href="#">2</a></li> <li><a href="#">3</a></li> <li><a href="#">»</a></li> </ul> <?php } } // enable gui form saver if (riake('gui_saver', $meta)) { ?> </form> <?php } } } // Inner Closing Wrapper echo $this->events->apply_filters('gui_inner_wrapper', ''); ?> </div> <?php echo $this->events->apply_filters('gui_footer', ''); ?> <?php }
/** * return a almost unique namespace for meta box for plugin which use GUI * @return string or bool (false) **/ function meta_namespace($segments) { if ($opened_module = get_core_vars('opened_module')) { return core_meta_namespace($segments, riake('namespace', $opened_module, 'custom')); } return false; }
loop_tags($post->keywords, array('item_class' => 'btn btn-xs btn-primary', 'divider' => ' ')); ?> <p> </p> <div class="author well"> <div class="media"> <div class="pull-left"> <img class="avatar img-thumbnail" src="<?php echo riake('avatar_link', $post->author); ?> " alt=""> </div> <div class="media-body"> <div class="media-heading"> <strong><?php echo $post->author['PSEUDO']; ?> </strong> </div> <p><?php echo riake('bio', $post->author); ?> </p> </div> </div> </div> <!--/.author--> <div id="comments"> <div id="comments-list"> <h3><?php echo $post->comments; ?> Commentaire(s)</h3> <?php if (have_blog_comments()) {
<div class="wrapper"> <div class="icon icon-grid"> <?php if ($appIconApi) { foreach ($appIconApi as $a) { eval(riake('admin_icons', $options)); if (isset($icons) && count($icons) > 1) { foreach ($icons as $i) { if ($i == $a['ICON_MODULE_NAMESPACE'] . '/' . $a['ICON_NAMESPACE']) { // .'?ajax=true' we're no more accessing ajax content, but directly app. ?> <div class="tendoo-icon-set" data-toggle="tooltip" data-placement="right" title="<?php echo $a['ICON_MODULE']['name']; ?> " modal-title="<?php echo $a['ICON_MODULE']['name']; ?> " data-url="<?php echo $this->instance->url->site_url(array('admin', 'open', 'modules', $a['ICON_MODULE']['namespace'])); ?> "> <img class="G-icon" src="<?php echo $this->instance->tendoo_admin->getAppImgIco($a['ICON_MODULE']['namespace']); ?> "> <p><?php echo word_limiter($a['ICON_MODULE']['name'], 4); ?> </p> <!--<span class="badge up bg-info m-l-n-sm">300</span>-->
public function __posttype_controller($namespace, $page = 'list', $id = 0, $taxonomy_arg1 = 'list', $taxonomy_arg2 = 0) { if ($this->current_posttype = riake($namespace, $this->config->item('posttypes'))) { $data['current_posttype'] = $this->current_posttype; $data['post_namespace'] = $namespace; if ($page === 'list') { $id = $id === 0 ? 1 : $id; $post_limit = 20; $post_nbr = count($this->current_posttype->get()); $pagination = pagination_helper($post_limit, $post_nbr, $id, site_url(array('dashboard', 'posttype', $namespace, 'list')), site_url(array('error', 'code', 'page-404'))); $this->config->set_item('pagination_data', $pagination); $post = $this->current_posttype->get(array(array('limit' => array('start' => riake('start', $pagination), 'end' => riake('end', $pagination))))); $data['post'] = $post; $data['post_list_label'] = $this->current_posttype->posts_list_label; $this->gui->set_title($this->current_posttype->posts_list_label); $this->load->view('../modules/post_type/views/list', $data, false); } else { if ($page === 'new') { $data['post_namespace'] = $namespace; $data['new_post_label'] = $this->current_posttype->new_post_label; $this->load->library('form_validation'); $this->form_validation->set_rules('post_title', __('Post title')); if ($this->form_validation->run()) { $return = $this->current_posttype->set($this->input->post('post_title'), $this->input->post('post_content'), riake('post_meta', $_POST, array()), riake('post_taxonomy', $_POST, array()), $this->input->post('post_status'), $this->input->post('post_parent'), $status = 'set'); if (riake('msg', $return) === 'custom-query-saved') { redirect(array('dashboard', 'posttype', $namespace, 'edit', riake('id', $return) . '?notice=' . riake('msg', $return))); } get_instance()->notice->push_notice($this->lang->line(riake('msg', $return))); } $this->gui->set_title($this->current_posttype->new_post_label); $this->load->view('../modules/post_type/views/create', $data, false); } else { if ($page === 'edit') { $this->load->library('form_validation'); $this->form_validation->set_rules('post_title', __('Post title')); if ($this->form_validation->run()) { $return = $this->current_posttype->update($this->input->post('post_title'), $this->input->post('post_content'), riake('post_meta', $_POST, array()), riake('post_taxonomy', $_POST, array()), $this->input->post('post_status'), $this->input->post('post_parent'), $status = 'publish', $id); if (riake('msg', $return) === 'custom-query-saved') { redirect(array('dashboard', 'posttype', $namespace, 'edit', riake('id', $return) . '?notice=' . riake('msg', $return))); } get_instance()->notice->push_notice($this->lang->line(riake('msg', $return))); } // print_array( get_core_vars( 'post' ) );die; $this->gui->set_title($this->current_posttype->edit_post_label); $this->load->view('../modules/post_type/views/edit', array('post_namespace' => $namespace, 'new_post_label' => $this->current_posttype->new_post_label, 'current_posttype' => $this->current_posttype, 'post' => farray($this->current_posttype->get(array(array('where' => array('id' => $id)))))), false); } else { if ($page === 'taxonomy') { // $id is taxonomy namespace here if (in_array($id, array_keys(force_array($taxonomy = $this->current_posttype->query->get_defined_taxonomies())))) { $data = array(); $data['current_taxonomy'] = $current_taxonomy = riake($id, $taxonomy); $data['taxonomy_namespace'] = $taxonomy_namespace = $id; $data['taxonomy'] = $taxonomy; $data['taxonomy_list_label'] = riake('taxonomy-list-label', $current_taxonomy); $data['post_namespace'] = $namespace; if ($taxonomy_arg1 === 'list') { $taxonomy_limit = 20; $taxonomy_arg2 = $taxonomy_arg2 === 0 ? 1 : $taxonomy_arg2; $taxonomies_nbr = count($this->current_posttype->query->get_taxonomies($taxonomy_namespace)); $pagination = pagination_helper($taxonomy_limit, $taxonomies_nbr, $taxonomy_arg2, site_url(array('dashboard', 'posttype', $namespace, $page, $id, $taxonomy_arg1)), site_url(array('error', 'code', 'page-404'))); $data['taxonomy_list_label'] = riake('taxonomy-list-label', $current_taxonomy); $data['taxonomies'] = $this->current_posttype->query->get_taxonomies($taxonomy_namespace, $pagination['start'], $pagination['end']); $data['taxonomies_nbr'] = $taxonomies_nbr; $data['pagination'] = $pagination; $data['current_taxonomy'] = $current_taxonomy; $this->gui->set_title(riake('new-taxonomy-label', $current_taxonomy)); $this->load->view('../modules/post_type/views/taxonomy-list', $data); } else { if ($taxonomy_arg1 === 'new') { $this->load->library('form_validation'); $this->form_validation->set_rules('taxonomy_title', __('Taxonomy Title'), 'required'); if ($this->form_validation->run()) { $result = $this->current_posttype->query->set_taxonomy($data['taxonomy_namespace'], $this->input->post('taxonomy_title'), $this->input->post('taxonomy_content'), in_array($this->input->post('taxonomy_parent'), array(false, ''), TRUE) ? null : $this->input->post('taxonomy_parent')); get_instance()->notice->push_notice($this->lang->line($result)); } $this->gui->set_title(riake('new-taxonomy-label', $current_taxonomy, __('New taxonomy'))); $this->load->view('../modules/post_type/views/taxonomy-create', $data, false); } else { if ($taxonomy_arg1 === 'edit') { $this->load->library('form_validation'); $this->form_validation->set_rules('taxonomy_title', __('Taxonomy Title'), 'required'); if ($this->form_validation->run()) { $result = $this->current_posttype->query->update_taxonomy($id, $this->input->post('taxonomy_title'), $this->input->post('taxonomy_content'), $taxonomy_arg2, in_array($this->input->post('taxonomy_parent'), array(false, ''), TRUE) ? null : $this->input->post('taxonomy_parent')); get_instance()->notice->push_notice($this->lang->line('taxonomy-set')); } $data['taxonomy_id'] = $taxonomy_arg2; $data['get_taxonomy'] = farray($this->current_posttype->query->get_taxonomies($taxonomy_namespace, $taxonomy_arg2, 'as_id')); $this->gui->set_title(riake('edit-taxonomy-label', $current_taxonomy, __('Edit taxonomy'))); $this->load->view('../modules/post_type/views/taxonomy-edit', $data); } } } } else { redirect(array('dashboard', 'error', 'unknow-taxonomy')); } } else { if ($page === 'comments') { if ($id === 'approve' && $taxonomy_arg1 != 0) { $exec = $this->current_posttype->query->comment_status($taxonomy_arg1, 1); if ($exec == 'comment-edited') { redirect(array('dashboard', 'posttype', $namespace, $page . '?notice=' . $exec)); } redirect(array('dashboard', 'posttype', $namespace, $page . '?notice=error-occured')); } else { if ($id === 'disapprove' && $taxonomy_arg1 != 0) { $exec = $this->current_posttype->query->comment_status($taxonomy_arg1, 4); if ($exec == 'comment-edited') { redirect(array('dashboard', 'posttype', $namespace, $page . '?notice=' . $exec)); } redirect(array('dashboard', 'posttype', $namespace, $page . '?notice=error-occured')); } else { if ($id === 'trash' && $taxonomy_arg1 != 0) { $exec = $this->current_posttype->query->comment_status($taxonomy_arg1, 3); if ($exec == 'comment-edited') { redirect(array('dashboard', 'posttype', $namespace, $page . '?notice=' . $exec)); } redirect(array('dashboard', 'posttype', $namespace, $page . '?notice=error-occured')); } else { if ($id === 'draft' && $taxonomy_arg1 != 0) { $exec = $this->current_posttype->query->comment_status($taxonomy_arg1, 0); if ($exec == 'comment-edited') { redirect(array('dashboard', 'posttype', $namespace, $page . '?notice=' . $exec)); } redirect(array('dashboard', 'posttype', $namespace, $page . '?notice=error-occured')); } else { if ($id === 'delete' && $taxonomy_arg1 != 0) { $exec = $this->current_posttype->query->delete_comment($taxonomy_arg1, 'as_id'); if ($exec == 'comment-edited') { redirect(array('dashboard', 'posttype', $namespace, $page . '?notice=' . $exec)); } redirect(array('dashboard', 'posttype', $namespace, $page . '?notice=error-occured')); } } } } } // $this->current_posttype->query->post_comment( 1 , 'Custom' , $author = false , $mode = 'create' , $comment_id = null , $author_name = 'Blair' , $author_email = '*****@*****.**' , $reply_to = false ); $id = $id === 0 ? 1 : $id; $comment_limit = 10; $comments_nbr = count($this->current_posttype->query->get_comments()); $pagination = pagination_helper($comment_limit, $comments_nbr, $id, site_url(array('dashboard', 'posttype', $namespace, 'comments')), site_url(array('error', 'code', 'page-404'))); $comments = $this->current_posttype->query->get_comments(array('limit' => array('start' => riake('start', $pagination), 'end' => riake('end', $pagination)))); $this->config->set_item('comments', $comments); $this->config->set_item('comments_list_label', $this->current_posttype->comments_list_label); $this->gui->set_title($this->current_posttype->comments_list_label); $this->load->view('../modules/post_type/views/comments-list', array('pagination_data' => $pagination, 'post_namespace' => $namespace, 'comments_list_label' => $this->current_posttype->comments_list_label, 'comments' => $comments), false); } else { if ($page === 'comment-edit') { } } } } } } } else { redirect(array('dashboard', 'error', 'unknow-post-type')); } }
public function add_permission($role_id, $action) { $role = $this->get($role_id); if ($role) { $roles_permissions = get_meta('roles_permissions'); $permissions = riake($role_id, $roles_permissions, array($role_id => array())); if (!in_array($action, force_array($permissions))) { $roles_permissions[$role_id][] = $action; set_meta('roles_permissions', $roles_permissions); return true; } } return false; }
<?php $this->gui->col_width(1, 3); $this->gui->col_width(2, 1); $this->events->add_filter('gui_before_cols', function () { return '<form method="post">'; }); $this->events->add_filter('gui_after_cols', function () { return '</form>'; }); $this->gui->add_meta(array('type' => 'unwrapped', 'namespace' => $taxonomy_namespace . '-create-new', 'col_id' => 1)); $this->gui->add_meta(array('type' => 'panel', 'title' => __('Details'), 'namespace' => $taxonomy_namespace . '-create-new-sidebar', 'col_id' => 2)); $this->gui->add_item(array('type' => 'text', 'name' => 'taxonomy_title', 'placeholder' => __('Enter a title')), $taxonomy_namespace . '-create-new', 1); if (riake('is_hierarchical', riake($taxonomy_namespace, $taxonomy)) === true) { $taxonomies = $current_posttype->query->get_taxonomies($taxonomy_namespace); $taxonomies_array = array(); $taxonomies_title = array(); foreach ($taxonomies as $_taxonomy) { $taxonomies_array[riake('ID', $_taxonomy)] = riake('TITLE', $_taxonomy); } $this->gui->add_item(array('type' => 'select', 'options' => $taxonomies_title, 'label' => __('Select a parent'), 'name' => 'taxonomy_parent', 'placeholder' => __('Select a parent')), $taxonomy_namespace . '-create-new', 1); } $this->gui->add_item(array('type' => 'textarea', 'name' => 'taxonomy_content', 'label' => __('Taxonomy description')), $taxonomy_namespace . '-create-new', 1); $this->gui->add_item(array('type' => 'buttons', 'name' => array('submit_content'), 'value' => array(__('Submit')), 'buttons_types' => array('submit')), $taxonomy_namespace . '-create-new-sidebar', 2); $this->gui->output();
<?php $result = $this->update_model->check(); if ($result) { // var_dump( $result ); ?> <h4><?php echo sprintf(__('Tendoo CMS : %s is available'), riake('title', $result[0])); ?> </h4> <p><?php echo riake('content', $result[0]); ?> </p> <span><a class="btn btn-primary" href="<?php echo site_url(array('dashboard', 'update', 'core', riake('id', $result[0]))); ?> "><?php _e('Click Here to Update'); ?> </a></span> <?php } else { ?> <h4><?php _e("You're up to date"); ?> </h4> <?php }
<?php $this->gui->cols_width(1, 4); $this->gui->set_meta(array('namespace' => core_meta_namespace(array('users', 'edit')), 'title' => __('Edit user'), 'type' => 'panel', 'form_wrap' => array('method' => 'POST')))->push_to(1); $this->gui->set_item(array('type' => 'text', 'attrs' => array('readonly' => 'readonly'), 'value' => $adminInfo['PSEUDO'], 'placeholder' => __('User Pseudo'), 'label' => __('User Pseudo')))->push_to(core_meta_namespace(array('users', 'edit'))); $this->gui->set_item(array('type' => 'text', 'name' => 'user_email', 'placeholder' => __('Enter Email'), 'text' => __('User Email'), 'label' => __('User Email'), 'value' => $adminInfo['EMAIL']))->push_to(core_meta_namespace(array('users', 'edit'))); // Get Roles $text[] = __('User Role'); $value[] = ''; foreach (force_array($get_roles) as $_role) { $value[] = riake('ID', $_role); $text[] = riake('NAME', $_role); } $this->gui->set_item(array('type' => 'select', 'name' => 'edit_priv', 'value' => $value, 'placeholder' => __('Select User Role'), 'text' => $text, 'active' => $adminInfo['REF_ROLE_ID'], 'label' => __('User Role')))->push_to(core_meta_namespace(array('users', 'edit'))); $this->gui->set_item(array('type' => 'hidden', 'name' => 'current_admin', 'value' => $adminInfo['PSEUDO']))->push_to(core_meta_namespace(array('users', 'edit'))); // Loading Generated Fields using "user_fields" hook $user_fields = trigger_filters('user_form_fields', array(get_core_vars('tendoo_user_fields'), $adminInfo['ID'])); // Filter user fields or add foreach (force_array($user_fields) as $field) { $this->gui->set_item($field)->push_to(core_meta_namespace(array('users', 'edit'))); } $this->gui->set_item(array('type' => 'buttons', 'name' => array('set_admin', 'delete_admin'), 'value' => array(__('Save User'), __('Delete User')), 'classes' => array('btn-primary', 'btn-warning'), 'button_types' => array('submit', 'submit'), 'attrs_string' => array('', 'onclick="return confirm( \'' . __('Do you really want to delete this user ?') . '\')" ')))->push_to(core_meta_namespace(array('users', 'edit'))); $this->gui->get();
$this->events->do_action_ref_array('after_post_editor', array($current_posttype, $this->gui, $post_namespace . '-create-new')); // Trigger each event bound $this->events->do_action_ref_array('before_post_publish', array($current_posttype, $this->gui, $post_namespace . '-create-new-sidebar')); // Trigger each event bound if (in_array('publish', riake('displays', $current_posttype->get_config()))) { if ($defined_taxonomies = $current_posttype->query->get_defined_taxonomies()) { foreach (force_array($defined_taxonomies) as $tax_namespace => $_taxonomy) { //current_posttype $taxonomy_array = array(); $taxonomies_list = $current_posttype->query->get_taxonomies($tax_namespace); foreach (force_array($taxonomies_list) as $_taxonomy) { $taxonomy_array[riake('ID', $_taxonomy)] = riake('TITLE', $_taxonomy); } $this->gui->add_item(array('type' => 'multiple', 'name' => 'post_taxonomy[' . $tax_namespace . '][]', 'options' => $taxonomy_array, 'label' => __('Select a taxonomy')), $post_namespace . '-create-new-sidebar', 2); } } $this->gui->add_item(array('type' => 'select', 'name' => 'post_status', 'options' => array(__('Draft'), __('Publish')), 'label' => __('Status')), $post_namespace . '-create-new-sidebar', 2); // is hierarchical if (riake('is-hierarchical', $current_posttype->get_config()) == true) { // get common post list $postlist = $current_posttype->get(); $postarray = array(-1 => __('No parent')); foreach (force_array($postlist) as $_post) { $postarray[riake('QUERY_ID', $_post)] = riake('TITLE', $_post); } $this->gui->add_item(array('type' => 'select', 'name' => 'post_parent', 'options' => $postarray, 'placeholder' => __('Choose a parent'), 'label' => __('Select Parent')), $post_namespace . '-create-new-sidebar', 2); } } $this->gui->add_item(array('type' => 'buttons', 'name' => array('submit_content'), 'value' => array(__('Submit')), 'buttons_types' => array('submit')), $post_namespace . '-create-new-sidebar', 2); // $this->events->do_action( 'after_post_publish' , array( $current_posttype , $this->gui , $post_namespace . '-create-new-sidebar' ) ); // Trigger each event bound $this->gui->output();
} trigger_events('after_title_inition', array($current_posttype, $this->gui, $post_namespace . '-create-new', $post)); // Trigger each event bound trigger_events('before_editor_inition', array($current_posttype, $this->gui, $post_namespace . '-create-new', $post)); // Trigger each event bound if (in_array('editor', riake('displays', $current_posttype->get_config()))) { $this->gui->set_item(array('type' => 'visual_editor', 'name' => 'post_content', 'value' => riake('CONTENT', $post)))->push_to($post_namespace . '-edit-new'); } trigger_events('after_editor_inition', array($current_posttype, $this->gui, $post_namespace . '-create-new', $post)); // Trigger each event bound trigger_events('before_publish_inition', array($current_posttype, $this->gui, $post_namespace . '-create-new-sidebar', $post)); // Trigger each event bound if (in_array('publish', riake('displays', $current_posttype->get_config()))) { if ($defined_taxonomies = $current_posttype->query->get_defined_taxonomies()) { foreach (force_array($defined_taxonomies) as $tax_namespace => $_taxonomy) { //current_posttype $taxonomy_text = $taxonomy_value = array(); $taxonomies_list = $current_posttype->query->get_taxonomies($tax_namespace); foreach (force_array($taxonomies_list) as $_taxonomy) { $taxonomy_text[] = riake('TITLE', $_taxonomy); $taxonomy_value[] = riake('ID', $_taxonomy); } $this->gui->set_item(array('type' => 'multiple', 'name' => 'post_taxonomy[' . $tax_namespace . '][]', 'text' => $taxonomy_text, 'value' => $taxonomy_value, 'label' => __('Select a taxonomy'), 'active' => riake('TAXONOMIES', $post)))->push_to($post_namespace . '-edit-new-sidebar'); } } $this->gui->set_item(array('type' => 'select', 'name' => 'post_status', 'text' => array(__('Draft'), __('Publish')), 'value' => array(0, 1), 'label' => __('Status'), 'active' => riake('STATUS', $post)))->push_to($post_namespace . '-edit-new-sidebar'); } trigger_events('after_publish_inition', array($current_posttype, $this->gui, $post_namespace . '-create-new-sidebar', $post)); // Trigger each event bound $this->gui->set_item(array('type' => 'buttons', 'name' => array('submit_content'), 'value' => array(__('Submit')), 'buttons_types' => array('submit')))->push_to($post_namespace . '-edit-new-sidebar'); $this->gui->get();
/** * Adds custom fields for user creation and edit * * @access : public * @params : Array * @return : Array **/ function user_custom_fields($config) { // refresh user meta $this->users->refresh_user_meta(); $this->gui->add_item(array('type' => 'text', 'name' => 'first-name', 'label' => __('First Name'), 'value' => $this->options->get('first-name', riake('user_id', $config))), riake('meta_namespace', $config), riake('col_id', $config)); $this->gui->add_item(array('type' => 'text', 'name' => 'last-name', 'label' => __('Last Name'), 'value' => $this->options->get('last-name', riake('user_id', $config))), riake('meta_namespace', $config), riake('col_id', $config)); ob_start(); $skin = $this->options->get('theme-skin', riake('user_id', $config)); ?> <h3><?php _e('Select a theme'); ?> </h3> <ul class="list-unstyled clearfix theme-selector"> <li style="float:left; width: 33.33333%; padding: 5px;"><a href="javascript:void(0);" data-skin="skin-blue" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover <?php echo $skin == 'skin-blue' ? 'active' : ''; ?> "> <div><span style="display:block; width: 20%; float: left; height: 7px; background: #367fa9;"></span><span class="bg-light-blue" style="display:block; width: 80%; float: left; height: 7px;"></span></div> <div><span style="display:block; width: 20%; float: left; height: 50px; background: #222d32;"></span><span style="display:block; width: 80%; float: left; height: 50px; background: #f4f5f7;"></span></div> </a> <p class="text-center no-margin">Blue</p> </li> <li style="float:left; width: 33.33333%; padding: 5px;"><a href="javascript:void(0);" data-skin="skin-black" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover <?php echo $skin == 'skin-black' ? 'active' : ''; ?> "> <div style="box-shadow: 0 0 2px rgba(0,0,0,0.1)" class="clearfix"><span style="display:block; width: 20%; float: left; height: 7px; background: #fefefe;"></span><span style="display:block; width: 80%; float: left; height: 7px; background: #fefefe;"></span></div> <div><span style="display:block; width: 20%; float: left; height: 50px; background: #222;"></span><span style="display:block; width: 80%; float: left; height: 50px; background: #f4f5f7;"></span></div> </a> <p class="text-center no-margin">Black</p> </li> <li style="float:left; width: 33.33333%; padding: 5px;"><a href="javascript:void(0);" data-skin="skin-purple" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover <?php echo $skin == 'skin-purple' ? 'active' : ''; ?> "> <div><span style="display:block; width: 20%; float: left; height: 7px;" class="bg-purple-active"></span><span class="bg-purple" style="display:block; width: 80%; float: left; height: 7px;"></span></div> <div><span style="display:block; width: 20%; float: left; height: 50px; background: #222d32;"></span><span style="display:block; width: 80%; float: left; height: 50px; background: #f4f5f7;"></span></div> </a> <p class="text-center no-margin">Purple</p> </li> <li style="float:left; width: 33.33333%; padding: 5px;"><a href="javascript:void(0);" data-skin="skin-green" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover <?php echo $skin == 'skin-green' ? 'active' : ''; ?> "> <div><span style="display:block; width: 20%; float: left; height: 7px;" class="bg-green-active"></span><span class="bg-green" style="display:block; width: 80%; float: left; height: 7px;"></span></div> <div><span style="display:block; width: 20%; float: left; height: 50px; background: #222d32;"></span><span style="display:block; width: 80%; float: left; height: 50px; background: #f4f5f7;"></span></div> </a> <p class="text-center no-margin">Green</p> </li> <li style="float:left; width: 33.33333%; padding: 5px;"><a href="javascript:void(0);" data-skin="skin-red" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover <?php echo $skin == 'skin-red' ? 'active' : ''; ?> "> <div><span style="display:block; width: 20%; float: left; height: 7px;" class="bg-red-active"></span><span class="bg-red" style="display:block; width: 80%; float: left; height: 7px;"></span></div> <div><span style="display:block; width: 20%; float: left; height: 50px; background: #222d32;"></span><span style="display:block; width: 80%; float: left; height: 50px; background: #f4f5f7;"></span></div> </a> <p class="text-center no-margin">Red</p> </li> <li style="float:left; width: 33.33333%; padding: 5px;"><a href="javascript:void(0);" data-skin="skin-yellow" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover <?php echo $skin == 'skin-yellow' ? 'active' : ''; ?> "> <div><span style="display:block; width: 20%; float: left; height: 7px;" class="bg-yellow-active"></span><span class="bg-yellow" style="display:block; width: 80%; float: left; height: 7px;"></span></div> <div><span style="display:block; width: 20%; float: left; height: 50px; background: #222d32;"></span><span style="display:block; width: 80%; float: left; height: 50px; background: #f4f5f7;"></span></div> </a> <p class="text-center no-margin">Yellow</p> </li> <li style="float:left; width: 33.33333%; padding: 5px;"><a href="javascript:void(0);" data-skin="skin-blue-light" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover <?php echo $skin == 'skin-blue-light' ? 'active' : ''; ?> "> <div><span style="display:block; width: 20%; float: left; height: 7px; background: #367fa9;"></span><span class="bg-light-blue" style="display:block; width: 80%; float: left; height: 7px;"></span></div> <div><span style="display:block; width: 20%; float: left; height: 50px; background: #f9fafc;"></span><span style="display:block; width: 80%; float: left; height: 50px; background: #f4f5f7;"></span></div> </a> <p class="text-center no-margin" style="font-size: 12px">Blue Light</p> </li> <li style="float:left; width: 33.33333%; padding: 5px;"><a href="javascript:void(0);" data-skin="skin-black-light" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover <?php echo $skin == 'skin-black-light' ? 'active' : ''; ?> "> <div style="box-shadow: 0 0 2px rgba(0,0,0,0.1)" class="clearfix"><span style="display:block; width: 20%; float: left; height: 7px; background: #fefefe;"></span><span style="display:block; width: 80%; float: left; height: 7px; background: #fefefe;"></span></div> <div><span style="display:block; width: 20%; float: left; height: 50px; background: #f9fafc;"></span><span style="display:block; width: 80%; float: left; height: 50px; background: #f4f5f7;"></span></div> </a> <p class="text-center no-margin" style="font-size: 12px">Black Light</p> </li> <li style="float:left; width: 33.33333%; padding: 5px;"><a href="javascript:void(0);" data-skin="skin-purple-light" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover <?php echo $skin == 'skin-purple-light' ? 'active' : ''; ?> "> <div><span style="display:block; width: 20%; float: left; height: 7px;" class="bg-purple-active"></span><span class="bg-purple" style="display:block; width: 80%; float: left; height: 7px;"></span></div> <div><span style="display:block; width: 20%; float: left; height: 50px; background: #f9fafc;"></span><span style="display:block; width: 80%; float: left; height: 50px; background: #f4f5f7;"></span></div> </a> <p class="text-center no-margin" style="font-size: 12px">Purple Light</p> </li> <li style="float:left; width: 33.33333%; padding: 5px;"><a href="javascript:void(0);" data-skin="skin-green-light" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover <?php echo $skin == 'skin-green-light' ? 'active' : ''; ?> "> <div><span style="display:block; width: 20%; float: left; height: 7px;" class="bg-green-active"></span><span class="bg-green" style="display:block; width: 80%; float: left; height: 7px;"></span></div> <div><span style="display:block; width: 20%; float: left; height: 50px; background: #f9fafc;"></span><span style="display:block; width: 80%; float: left; height: 50px; background: #f4f5f7;"></span></div> </a> <p class="text-center no-margin" style="font-size: 12px">Green Light</p> </li> <li style="float:left; width: 33.33333%; padding: 5px;"><a href="javascript:void(0);" data-skin="skin-red-light" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover <?php echo $skin == 'skin-red-light' ? 'active' : ''; ?> "> <div><span style="display:block; width: 20%; float: left; height: 7px;" class="bg-red-active"></span><span class="bg-red" style="display:block; width: 80%; float: left; height: 7px;"></span></div> <div><span style="display:block; width: 20%; float: left; height: 50px; background: #f9fafc;"></span><span style="display:block; width: 80%; float: left; height: 50px; background: #f4f5f7;"></span></div> </a> <p class="text-center no-margin" style="font-size: 12px">Red Light</p> </li> <li style="float:left; width: 33.33333%; padding: 5px;"><a href="javascript:void(0);" data-skin="skin-yellow-light" style="display: block; box-shadow: 0 0 3px rgba(0,0,0,0.4)" class="clearfix full-opacity-hover <?php echo $skin == 'skin-yellow-light' ? 'active' : ''; ?> "> <div><span style="display:block; width: 20%; float: left; height: 7px;" class="bg-yellow-active"></span><span class="bg-yellow" style="display:block; width: 80%; float: left; height: 7px;"></span></div> <div><span style="display:block; width: 20%; float: left; height: 50px; background: #f9fafc;"></span><span style="display:block; width: 80%; float: left; height: 50px; background: #f4f5f7;"></span></div> </a> <p class="text-center no-margin" style="font-size: 12px;">Yellow Light</p> </li> </ul> <input type="hidden" name="theme-skin" value="<?php echo $skin; ?> " /> <style> .theme-selector li a.active { opacity:1 !important; box-shadow:0px 0px 5px 2px #666 !important; } </style> <script> $( '.theme-selector li a' ).each(function(){ $(this).bind( 'click' , function(){ // remove active status $( '.theme-selector li a' ).each( function(){ $(this).removeClass( 'active' ); }); $(this).toggleClass( 'active' ); $('input[name="theme-skin"]').val( $(this).data( 'skin' ) ); // console.log( $(this).data( 'skin' ) ); }); }) </script> <?php $dom = ob_get_clean(); riake('gui', $config)->add_item(array('type' => 'dom', 'content' => $dom), riake('meta_namespace', $config), riake('col_id', $config)); // Clean unset($skin, $config, $dom); }
function get($type) { return riake($type, $this->notices); }
<?php $this->gui->col_width(1, 4); $this->gui->add_meta(array('type' => 'box', 'namespace' => $post_namespace . '-table-list', 'title' => $post_list_label, 'col_id' => 1)); $default_cols = array(__('Select'), __('Title'), __('Excerpt'), __('By'), __('On'), __('Status')); $table_row = array(); foreach (force_array($post) as $_post) { $user = User::get(riake('AUTHOR', $_post), 'as_id'); $table_row[] = array('<input type="checkbox" name="post_id[]" style="height:30px" value="' . riake('QUERY_ID', $_post) . '">', '<a href="' . site_url(array('dashboard', 'posttype', $post_namespace, 'edit', xss_clean(riake('QUERY_ID', $_post)))) . '">' . xss_clean(riake('TITLE', $_post)) . '</a>', '', User::pseudo(riake('AUTHOR', $_post)), riake('DATE', $_post), ''); } $this->gui->add_item(array('type' => 'table', 'cols' => $default_cols, 'rows' => $table_row, 'cols_width' => array(5, 200, 100, 100, 100, 100)), $post_namespace . '-table-list', 1); $this->gui->output();
/** * Disable * * Disable module using namespace provided as unique parameter * * @access public * @author blair Jersyer * @copyright 2015 * @param string $namespace module namespace string * @since 3.0.1 * @return void */ static function disable($module_namespace) { global $Options; $activated_modules = riake('actives_modules', $Options); if (in_array($module_namespace, $activated_modules)) { $key = array_search($module_namespace, $activated_modules); unset($activated_modules[$key]); get_instance()->options->set('actives_modules', $activated_modules, true); // Check whether cache is enabled if (riake('enable_cache', $Options)) { // Delete modules list cache get_instance()->db->cache_delete('dashboard', 'modules', 'list'); } } }
<div class="form-group has-feedback"> <input class="form-control" type="password" name="user_password_confirm" placeholder="<?php _e('Confirm password'); ?> "/> <span class="glyphicon glyphicon-lock form-control-feedback"></span> </div> <div class="form-group has-feedback"> <input class="form-control" type="text" name="user_mail" placeholder="<?php _e('Email'); ?> "/> <span class="glyphicon glyphicon-envelope form-control-feedback"></span> </div> <?php if (riake('allow_privilege_selection', $options) == "1") { ?> <div class="form-group"> <select class="form-control" name="priv_id"> <option value=""><?php _e('Select a role'); ?> </option> <?php foreach ($allowPrivilege as $a) { ?> <option value="<?php echo $a['PRIV_ID']; ?> "><?php echo $a['NAME'];
<?php $this->gui->col_width(1, 3); $this->gui->col_width(2, 1); $this->events->add_filter('gui_before_cols', function () { return '<form method="post">'; }); $this->events->add_filter('gui_after_cols', function () { return '</form>'; }); $this->gui->add_meta(array('type' => 'unwrapped', 'namespace' => $taxonomy_namespace . '-create-new', 'col_id' => 1)); $this->gui->add_meta(array('type' => 'panel', 'title' => __('Details'), 'namespace' => $taxonomy_namespace . '-create-new-sidebar', 'col_id' => 2)); $this->gui->add_item(array('type' => 'text', 'name' => 'taxonomy_title', 'placeholder' => __('Enter a title'), 'value' => riake('TITLE', $get_taxonomy)), $taxonomy_namespace . '-create-new', 1); if (riake('is_hierarchical', riake($taxonomy_namespace, $taxonomy)) === true) { $taxonomies = $current_posttype->query->get_taxonomies($taxonomy_namespace, $taxonomy_id, 'as_excluded_id'); $taxonomies_array = array(); foreach ($taxonomies as $_taxonomy) { $taxonomies_array[riake('ID', $_taxonomy)] = riake('TITLE', $_taxonomy); } $this->gui->add_item(array('type' => 'select', 'options' => $taxonomies_title, 'label' => __('Select a parent'), 'name' => 'taxonomy_parent', 'placeholder' => __('Select a parent'), 'active' => riake('PARENT_REF_ID', $get_taxonomy)), $taxonomy_namespace . '-create-new', 1); } $this->gui->add_item(array('type' => 'textarea', 'name' => 'taxonomy_content', 'value' => riake('CONTENT', $get_taxonomy), 'label' => __('Taxonomy description')), $taxonomy_namespace . '-create-new', 1); $this->gui->add_item(array('type' => 'buttons', 'name' => array('submit_content'), 'value' => array(__('Submit')), 'buttons_types' => array('submit')), $taxonomy_namespace . '-create-new-sidebar', 2); $this->gui->output();
function translate($code, $textdomain = 'tendoo-core') { $final_lines = array(); $instance = get_instance(); $heavy__ = array(); if (in_array($instance->config->item('language'), $instance->config->item('supported_lang'))) { // Lang Recorder is only enabled while en_US lang is activated if (LANG_RECORDER_ENABLED == true && ($textdomain = 'tendoo-core')) { if (!file_exists(APPPATH . 'language/' . $instance->config->item('language') . '/' . $instance->config->item('language') . '.po')) { $lang_file = fopen(APPPATH . 'language/' . $instance->config->item('language') . '/' . $instance->config->item('language') . '.po', 'a+'); fwrite($lang_file, 'msgid ""' . PHP_EOL); fwrite($lang_file, 'msgstr ""' . PHP_EOL); fwrite($lang_file, '"Plural-Forms: nplurals=2; plural=(n != 1);\\n"' . PHP_EOL); fwrite($lang_file, '"Project-Id-Version: Tendoo CMS Translation\\n"' . PHP_EOL); fwrite($lang_file, '"Last-Translator: Translate <*****@*****.**>\\n"' . PHP_EOL); fwrite($lang_file, '"POT-Creation-Date: \\n"' . PHP_EOL); fwrite($lang_file, '"PO-Revision-Date: \\n"' . PHP_EOL); fwrite($lang_file, '"Last-Translator: \\n"' . PHP_EOL); fwrite($lang_file, '"Language-Team: Tendoo Lang Team\\n"' . PHP_EOL); fwrite($lang_file, '"MIME-Version: 1.0\\n"' . PHP_EOL); fwrite($lang_file, '"Content-Type: text/plain; charset=UTF-8\\n"' . PHP_EOL); fwrite($lang_file, '"Content-Transfer-Encoding: 8bit\\n"' . PHP_EOL); fwrite($lang_file, '"Language: en_US\\n"' . PHP_EOL); fwrite($lang_file, '"X-Generator: Tendoo ' . get('core_id') . '\\n"' . PHP_EOL); fwrite($lang_file, '"X-Poedit-SourceCharset: UTF-8\\n"' . PHP_EOL); fwrite($lang_file, PHP_EOL); fclose($lang_file); } $lang_file = fopen(APPPATH . 'language/' . $instance->config->item('language') . '/' . $instance->config->item('language') . '.po', 'a+'); while (($line = fgets($lang_file)) !== false) { if (substr($line, 0, 5) == 'msgid') { $msgid = explode('"', $line); $latest = riake(1, $msgid); } if (substr($line, 0, 6) == 'msgstr') { $msgstr = explode('"', $line); $heavy__[$latest] = riake(1, $msgstr); } } fclose($lang_file); if (!in_array(htmlentities($code, ENT_QUOTES), array_keys($heavy__))) { $bt = debug_backtrace(); $caller = array_shift($bt); $lang_file = fopen(APPPATH . 'language/' . $instance->config->item('language') . '/' . $instance->config->item('language') . '.po', 'a+'); fwrite($lang_file, '#: ' . $caller['file'] . ':' . $caller['line'] . PHP_EOL); fwrite($lang_file, 'msgid "' . htmlentities($code, ENT_QUOTES) . '"' . PHP_EOL); fwrite($lang_file, 'msgstr "' . htmlentities($code, ENT_QUOTES) . '"' . PHP_EOL); fwrite($lang_file, PHP_EOL); fclose($lang_file); } } } if (file_exists(APPPATH . 'language/' . $instance->config->item('language') . '/' . $instance->config->item('language') . '.po')) { $lang_file = fopen(APPPATH . 'language/' . $instance->config->item('language') . '/' . $instance->config->item('language') . '.po', 'r'); while (($line = fgets($lang_file)) !== false) { if (substr($line, 0, 5) == 'msgid') { $msgid = explode('"', $line); $latest = riake(1, $msgid); } if (substr($line, 0, 6) == 'msgstr') { $msgstr = explode('"', $line); $heavy__[$latest] = riake(1, $msgstr); } } fclose($lang_file); } return riake(htmlentities($code, ENT_QUOTES), $heavy__, $code); }