Esempio n. 1
0
/**
 * Return (string) selected information associated with a keyword. Optional $notfound = string default message if nothing found
 *
 */
function yourls_get_keyword_info($keyword, $field, $notfound = false)
{
    // Allow plugins to short-circuit the whole function
    $pre = yourls_apply_filter('shunt_get_keyword_info', false, $keyword, $field, $notfound);
    if (false !== $pre) {
        return $pre;
    }
    $keyword = yourls_sanitize_string($keyword);
    $infos = yourls_get_keyword_infos($keyword);
    $return = $notfound;
    if (isset($infos[$field]) && $infos[$field] !== false) {
        $return = $infos[$field];
    }
    return yourls_apply_filter('get_keyword_info', $return, $keyword, $field, $notfound);
}
Esempio n. 2
0
function yourls_get_keyword_info($keyword, $field, $notfound = false)
{
    global $ydb;
    $keyword = yourls_sanitize_string($keyword);
    $infos = yourls_get_keyword_infos($keyword);
    if (isset($infos[$field]) && $infos[$field] !== false) {
        return $infos[$field];
    }
    return $notfound;
}
 /**
  * Action: yourls_ajax_laemmi_edit_ldapgroup
  */
 public function action_yourls_ajax_laemmi_edit_ldapgroup()
 {
     $keyword = yourls_sanitize_string($this->getRequest('keyword'));
     $nonce = $this->getRequest('nonce');
     $id = yourls_string2htmlid($keyword);
     yourls_verify_nonce('laemmi_edit_ldapgroup_' . $id, $nonce, false, 'omg error');
     $nonce = yourls_create_nonce('laemmi_edit_ldapgroup_save_' . $id);
     $infos = yourls_get_keyword_infos($keyword);
     $projectlist_value = (array) @json_decode($infos[self::SETTING_URL_PROJECTS], true);
     $projectlist = [];
     foreach ($this->_options['projectlist'] as $key => $val) {
         if ($this->_hasPermission(self::PERMISSION_ACTION_ADD_OTHER_PROJECT) || $this->_hasPermission('action-edit', [$key])) {
             $projectlist[$key] = $key;
         }
     }
     $html = $this->getTemplate()->render('edit_row_project', ['keyword' => $keyword, 'nonce' => $nonce, 'id' => $id, 'projectlist' => $projectlist, 'projectlist_value' => $projectlist_value]);
     echo json_encode(['html' => $html]);
 }
Esempio n. 4
0
function yourls_get_keyword_info($keyword, $field, $notfound = false)
{
    $keyword = yourls_sanitize_string($keyword);
    $infos = yourls_get_keyword_infos($keyword);
    $return = $notfound;
    if (isset($infos[$field]) && $infos[$field] !== false) {
        $return = $infos[$field];
    }
    return yourls_apply_filter('get_keyword_info', $return, $keyword, $field, $notfound);
}
 /**
  * Filter: table_add_row_cell_array
  *
  * @return mixed
  */
 public function filter_table_add_row_cell_array()
 {
     list($cells, $keyword, $url, $title, $ip, $clicks, $timestamp) = func_get_args();
     $permissions = $this->helperGetAllowedPermissions();
     if (isset($permissions[self::PERMISSION_LIST_SHOW_LABEL])) {
         $infos = yourls_get_keyword_infos($keyword);
         $label = json_decode($infos[self::SETTING_URL_LABEL], true);
         $label = @implode('</span><span>', $label);
         if ($label) {
             $cells['url']['template'] .= '<div class="laemmi_label"><span>%laemmi_label%</span></div>';
             $cells['url']['laemmi_label'] = $label;
         }
     }
     if (isset($permissions[self::PERMISSION_LIST_SHOW_COMMENT])) {
         $infos = yourls_get_keyword_infos($keyword);
         $comment = trim($infos[self::SETTING_URL_COMMENT]);
         if ($comment) {
             $cells['url']['template'] .= '<div class="laemmi_comment"><dl><dt><a href="#">%laemmi_comment_title%</a></dt><dd>%laemmi_comment%</dd></dl></div>';
             $cells['url']['laemmi_comment_title'] = yourls__('Comment', self::APP_NAMESPACE);
             $cells['url']['laemmi_comment'] = $comment;
         }
     }
     return $cells;
 }