<commit_before><?php
class Vpc_Advanced_SocialBookmarks_Component extends Vpc_Abstract
{
    public static function getSettings()
    {
        $ret = parent::getSettings();
        $ret['componentName'] = trlVps('Social Bookmarks');
        $ret['ownModel'] = 'Vpc_Advanced_SocialBookmarks_Model';
        $ret['cssClass'] = 'webStandard';
        $ret['iconSet'] = 'Rounded';
        $ret['flags']['alternativeComponent'] = 'Vpc_Advanced_SocialBookmarks_Inherit_Component';
        $ret['extConfig'] = 'Vpc_Abstract_Composite_ExtConfigForm';
        return $ret;
    }

    private function _getNetworks($currentPage)
    {
        //TODO: funktioniert mit mehreren domains nicht korrekt
        $pageUrl = 'http://'.Vps_Registry::get('config')->server->domain.$currentPage->url;

        $networks = array();
        foreach (Vps_Model_Abstract::getInstance('Vpc_Advanced_SocialBookmarks_AvaliableModel')->getRows() as $n) {
            $networks[$n->id] = $n->toArray();
        }
        $s = new Vps_Model_Select();
        $s->order('pos');
        $ret = array();
        foreach ($this->getRow()->getChildRows('Networks', $s) as $net) {
            if (isset($networks[$net->network_id])) {
                $icon = '/Vpc/Advanced/SocialBookmarks/Icons/'.$this->_getSetting('iconSet').'/';
                if (file_exists(VPS_PATH.$icon.$net->network_id.'.jpg')) {
                    $icon .= $net->network_id.'.jpg';
                } else if (file_exists(VPS_PATH.$icon.$net->network_id.'.png')) {
                    $icon .= $net->network_id.'.png';
                } else {
                    $icon = false;
                }
                if ($icon) $icon = '/assets/vps'.$icon;
                $url = str_replace('{0}', $pageUrl, $networks[$net->network_id]['url']);
                $ret[] = array(
                    'name' => $networks[$net->network_id]['name'],
                    'url' => $url,
                    'icon' => $icon
                );
            }
        }
        return $ret;
    }

    public function getTemplateVarsWithNetworks($currentPage)
    {
        $ret = parent::getTemplateVars();
        $ret['networks'] = $this->_getNetworks($this->getData()->parent);
        return $ret;
    }
<commit_msg>SocialBookmarks: Bugfix, url wasn't set correctly in subpages<commit_after><?php
class Vpc_Advanced_SocialBookmarks_Component extends Vpc_Abstract
{
    public static function getSettings()
    {
        $ret = parent::getSettings();
        $ret['componentName'] = trlVps('Social Bookmarks');
        $ret['ownModel'] = 'Vpc_Advanced_SocialBookmarks_Model';
        $ret['cssClass'] = 'webStandard';
        $ret['iconSet'] = 'Rounded';
        $ret['flags']['alternativeComponent'] = 'Vpc_Advanced_SocialBookmarks_Inherit_Component';
        $ret['extConfig'] = 'Vpc_Abstract_Composite_ExtConfigForm';
        return $ret;
    }

    private function _getNetworks($currentPage)
    {
        //TODO: funktioniert mit mehreren domains nicht korrekt
        $pageUrl = 'http://'.Vps_Registry::get('config')->server->domain.$currentPage->url;

        $networks = array();
        foreach (Vps_Model_Abstract::getInstance('Vpc_Advanced_SocialBookmarks_AvaliableModel')->getRows() as $n) {
            $networks[$n->id] = $n->toArray();
        }
        $s = new Vps_Model_Select();
        $s->order('pos');
        $ret = array();
        foreach ($this->getRow()->getChildRows('Networks', $s) as $net) {
            if (isset($networks[$net->network_id])) {
                $icon = '/Vpc/Advanced/SocialBookmarks/Icons/'.$this->_getSetting('iconSet').'/';
                if (file_exists(VPS_PATH.$icon.$net->network_id.'.jpg')) {
                    $icon .= $net->network_id.'.jpg';
                } else if (file_exists(VPS_PATH.$icon.$net->network_id.'.png')) {
                    $icon .= $net->network_id.'.png';
                } else {
                    $icon = false;
                }
                if ($icon) $icon = '/assets/vps'.$icon;
                $url = str_replace('{0}', $pageUrl, $networks[$net->network_id]['url']);
                $ret[] = array(
                    'name' => $networks[$net->network_id]['name'],
                    'url' => $url,
                    'icon' => $icon
                );
            }
        }
        return $ret;
    }

    public function getTemplateVarsWithNetworks($currentPage)
    {
        $ret = parent::getTemplateVars();
        $ret['networks'] = $this->_getNetworks($currentPage);
        return $ret;
    }

{'fraction_non_alphanumeric': 0.16424162257495592, 'fraction_numerical': 0.0004409171075837742, 'mean_word_length': 2.1816269284712484, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3005372', 'n_tokens_mistral': 1388, 'n_tokens_neox': 1344, 'n_words': 207}